Advertisement
electricmaster

JS Slider

Aug 24th, 2011
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var slides = 4;
  2. var current = 1;
  3. var duration = 7000; // Milliseconds
  4. function slide(){
  5.     document.getElementById("slide"+current).style.animation = "slide_backward 2s infinite";
  6.     current+1;
  7.     if(current > slides) current = 1;
  8.     document.getElementById("slide"+current).style.animation = "slide_forward 2s infinite";
  9.     setTimeout(slide(),duration);
  10. }
  11. setTimeout(slide(),duration);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement