Skip to content

Instantly share code, notes, and snippets.

@spadino
Created July 26, 2018 16:24
Show Gist options
  • Save spadino/f9cc14d28f284c20ed9b4cf1dfca326d to your computer and use it in GitHub Desktop.
Save spadino/f9cc14d28f284c20ed9b4cf1dfca326d to your computer and use it in GitHub Desktop.
$(function(){
$('#maximage').maximage({
cycleOptions: {
fx: 'fade',
speed: 1000, // Has to match the speed for CSS transitions in jQuery.maximage.css (lines 30 - 33)
timeout: 5000,
prev: '#arrow_left',
next: '#arrow_right',
pause: 0,
before: function(last,current){
if(!$.browser.msie){
// Start HTML5 video when you arrive
if($(current).find('video').length > 0) $(current).find('video')[0].play();
}
},
after: function(last,current){
if(!$.browser.msie){
// Pauses HTML5 video when you leave it
if($(last).find('video').length > 0) $(last).find('video')[0].pause();
}
}
},
onFirstImageLoaded: function(){
jQuery('#cycle-loader').hide();
jQuery('#maximage').fadeIn('fast');
}
});
// Helper function to Fill and Center the HTML5 Video
jQuery('video,object').maximage('maxcover');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment