jquery - Changing click code to a auto loopable version -


i have bit of code:

function slideshow_animateclick(){     slideshowitem_position = 0 - (slideshowitem_place * 1920);     $('#slideshowcontent').stop().animate({'left':slideshowitem_position + 'px'}, 1000, 'swing');   } 

... left/right buttons click function in horizontal slideshow.

i need copy loopable version. want slideshow play until left/right buttons clicked. once happens, nice set sort of idle time condition after wich slideshow resume autoplay again.

full context - fiddle

thanx.

pedro

edit: added fiddle here: http://jsfiddle.net/jns3h/12/ code , fix.

to interval timer, can this:

//create function handle auto rotate function autorotate() {     //code here happens every n seconds }  //create function holds interval auto rotate push function rotate(){     var startrotate = setinterval(function(){  //start autorotate on load rotate every 2 seconds.               autorotate();     }, 2000); }  $('.rightarrow, .leftarrow').click(function(){     clearinterval(startrotate);  //stops auto-animation     cleartimeout(startagain);   //stops starting again - incase click again, resets timeout     //write code here when click on right arrow     var startagain = settimeout(function(){  //then create timeout start rotating again after click         rotate();     }, 2000); });  $(document).load(function(){     rotate(); }); 

this loose code of course, have fill in blanks , test it, believe principal correct.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -