Skip to content

Instantly share code, notes, and snippets.

@batandwa
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save batandwa/8845316 to your computer and use it in GitHub Desktop.

Select an option

Save batandwa/8845316 to your computer and use it in GitHub Desktop.
Simple fade slideshow by Jonathan Snook (http://snook.ca/archives/javascript/simplest-jquery-slideshow).
<div class="fadein">
<img src="http://farm3.static.flickr.com/2610/4148988872_990b6da667.jpg">
<img src="http://farm3.static.flickr.com/2597/4121218611_040cd7b3f2.jpg">
<img src="http://farm3.static.flickr.com/2531/4121218751_ac8bf49d5d.jpg">
</div>
$.fn.slideShow = function(timeOut) {
var $elem = this;
this.children(':gt(0)').hide();
setInterval(function() {
$elem.children().eq(0).fadeOut().next().fadeIn().end().appendTo($elem);
}, timeOut || 3000);
};
$(function() {
$('.fadein').slideShow();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment