I have an HTML5 video embedded in a page configured to autostart on load. When the menu switches, it is hidden and a series of images appears in its place. When the menu is closed, the video returns. It was recommended that I pause the video while it is hidden, and resume it as soon as it returns in order to save the resources that I would like to make, but stop and restart (instead of resuming).
Any suggestions? I know this is a gray area.
Thank!
HTML:
<div id="content">
<video id="vid_home" width="780" height="520" autoplay="autoplay" loop="loop">
<source src="Video/fernando.m4v" type="video/mp4" />
<source src="Video/fernando.ogg" type="video/ogg" />
Your browser does not support this video playback.
</video>
<img id="img_home" src="Images/home.jpg" alt="Fernando Garibay />
</div>
JavaScript:
$('#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');
});
$('#trigger').mouseleave(function(){
$('#img_home').fadeOut(400, function(){
$('#vid_home').fadeIn(400);
});
});
source
share