Guest User

Untitled

a guest
Apr 16th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $('#button').click(function(e) {
  2.     timer = setInterval("start()", 2000);
  3.     item = 0;
  4.     max = 2;
  5.     return false;
  6. });
  7.  
  8. // fake click the button
  9. $('#button').trigger('click');
  10.  
  11. function start() {
  12.     (item > max) ? item = 0 : null;
  13.    
  14.     switch(item) {
  15.         case 0:
  16.             // animate here
  17.             item++;
  18.         case 1:
  19.             // animate here    
  20.             item++;
  21.         case 2:
  22.             // animate here
  23.             item++;
  24.         break;
  25.     }
  26.  
  27. }
Add Comment
Please, Sign In to add comment