Advertisement
Guest User

image-rotator.js

a guest
Jan 17th, 2011
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. <script type="text/javascript">
  2. $(document).ready(function(){
  3.  
  4. //This keeps track of the slideshow's current location
  5. var current_panel = 1;
  6. //Controlling the duration of animation by variable will simplify changes
  7. var animation_duration = 2500;
  8.  
  9. $.timer(6000, function (timer) {
  10. //Determine the current location, and transition to next panel
  11. switch(current_panel){
  12. case 1:
  13. $("#slideshow").stop().animate({left: "-960px", top: "0px"}, {easing: 'easeOutBack', duration: animation_duration});
  14. current_panel = 2;
  15. break;
  16. case 2:
  17. $("#slideshow").stop().animate({left: "0px", top: "-350px"}, {easing: 'easeOutBack', duration: animation_duration});
  18. current_panel = 3;
  19. break;
  20. case 3:
  21. $("#slideshow").stop().animate({left: "-960px", top: "-350px"}, {easing: 'easeOutBack', duration: animation_duration});
  22. current_panel = 4;
  23. break;
  24. case 4:
  25. $("#slideshow").stop().animate({left: "0px", top: "0px"}, {easing: 'easeOutBack', duration: animation_duration});
  26. current_panel = 1;
  27. break;
  28. timer.reset(12000);
  29. }
  30. });
  31.  
  32. });
  33. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement