Return to Snippet

Revision: 56300
at March 21, 2012 03:31 by accelm


Initial Code
jQuery(document).ready(function($) {
	setInterval("autoSlide()", 10000);
});

function autoSlide(){
	var nextidx = (parseInt(jQuery("#slideshow .current").index()+1) == jQuery("#slideshow .slide").length) ? 0 : parseInt(jQuery("#slideshow .current").index()+1);
	jQuery("#slideshow .current").fadeOut('slow', function(){
		jQuery(this).removeClass('current');
		jQuery("#slideshow .slide").eq(nextidx).fadeIn('slow', function(){
			jQuery(this).addClass('current');
		});
	});
}

Initial URL

                                

Initial Description
This goes through the specified div, and finds a div with the class of current.   It then removes the class from that div, and adds it onto the next one.  Note: Through CSS make the current class with a display block, and the slide class with a display none.

Initial Title
Simple Autoslide

Initial Tags
jquery

Initial Language
jQuery