Skip to content

Instantly share code, notes, and snippets.

@jankeesvw
Created June 18, 2012 12:16
Show Gist options
  • Save jankeesvw/2948111 to your computer and use it in GitHub Desktop.
Save jankeesvw/2948111 to your computer and use it in GitHub Desktop.
function showNextImage() {
var images = $(".widget-holder.slideshow img");
for (var i = 0; i < images.length; i++) {
var obj = $(images[i]);
if (obj.hasClass('current')) {
// we found the current item!
break;
}
}
obj.fadeOut('slow');
obj.removeClass('current');
if (i++ >= images.length) {
i = 0;
}
obj = $(images[i]);
obj.fadeIn('slow');
obj.addClass('current');
setTimeout(function () {
showNextImage();
}, 5000);
}
function enableSlideshow() {
setTimeout(function () {
showNextImage();
}, 5000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment