Skip to content

Instantly share code, notes, and snippets.

@PerpetualBeta
Created October 27, 2012 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PerpetualBeta/3964231 to your computer and use it in GitHub Desktop.
Save PerpetualBeta/3964231 to your computer and use it in GitHub Desktop.
Cycle through a series of images. Fade transition between slides. Loops back to first slide at end of collection.
// Requires the jQuery library - http://jquery.com/
// Demo: http://jsfiddle.net/DarkBlue/zM3A2/3/embedded/result/
function slideshow(){var a=$("#animation img.active");a.length==0&&(a=$("#animation img:last"));var b=a.next().length?a.next():$("#animation img:first");a.addClass("last-active");b.css({opacity:0}).addClass("active").animate({opacity:1},1E3,function(){a.removeClass("active last-active")})}$(function(){setInterval("slideshow()",5E3)});
@PerpetualBeta
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment