/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var loopingInterval; var mySlideDeck = jQuery('.slidedeck').slidedeck(); mySlideDeck.vertical(); var interval = 1000; var firstDelay = 3000; // initialize an autoplay switch var autoPlay = false; var autoPlayLoop = true; function autoPlayAdvanceLoop(){ if(autoPlay){ // Check to see if the current slide is the last slide if(mySlideDeck.current == mySlideDeck.slides.length && autoPlayLoop == true){ // This is the last slide, go to the first slide mySlideDeck.goTo(1); } else { // This is not the last slide, go to the next slide mySlideDeck.next(); } } } // sets an initial delay setTimeout(function(){ loopingInterval = setInterval(autoPlayAdvanceLoop,interval); // Run the autoPlayAdvanceLoop() function every interval milliseconds }, firstDelay - interval) autoPlay = true; // Stop autoPlay if the deck is clicked. jQuery('.slidedeck').click(function(){ autoPlay = false; clearInterval(loopingInterval); });
URL: http://getsatisfaction.com/slidedeck/topics/slide_time
Comments
