Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery stop HTML5 video when hidden, restart when visibile
    primarykey
    data
    text
    <p>I've got an HTML5 video embedded in a page that's set for autoplay on load. When a menu is toggled, it is hidden and a series of images take its place. When the menu is put closed, the video returns. It was recommended that I stop the video while it's hidden and resume it once it's back to conserve resources, which I'd like to do, but stop and restart (instead of resume).</p> <p>Any suggestions? I know it's a grey area.</p> <p>Thanks!</p> <p>HTML:</p> <pre><code>&lt;div id="content"&gt; &lt;video id="vid_home" width="780" height="520" autoplay="autoplay" loop="loop"&gt; &lt;source src="Video/fernando.m4v" type="video/mp4" /&gt; &lt;source src="Video/fernando.ogg" type="video/ogg" /&gt; Your browser does not support this video's playback. &lt;/video&gt; &lt;img id="img_home" src="Images/home.jpg" alt="Fernando Garibay /&gt; &lt;/div&gt; </code></pre> <p>Javascript:</p> <pre><code>// Navigation hover image preview $('#img_home').css('display', 'none'); $('.nav').hover(function(){ $('#vid_home').fadeOut(600, function(){ $('#img_home').fadeIn(800); }); }); $('#item1').hover(function(){ $('#img_home').attr('src', 'Images/music.jpg'); }); $('#item2').hover(function(){ $('#img_home').attr('src', 'Images/photos.jpg'); }); $('#item3').hover(function(){ $('#img_home').attr('src', 'Images/biography.jpg'); }); $('#item4').hover(function(){ $('#img_home').attr('src', 'Images/discography.jpg'); }); $('#item5').hover(function(){ $('#img_home').attr('src', 'Images/contact.jpg'); }); $('#item6').hover(function(){ $('#img_home').attr('src', 'Images/blog.png'); }); // Navigation hover image leave $('#trigger').mouseleave(function(){ $('#img_home').fadeOut(400, function(){ $('#vid_home').fadeIn(400); }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload