Posted By

brianyang on 06/23/10


Tagged


Versions (?)

coverflow autoplay


 / Published in: jQuery
 

reverse play not finished, http://bit.ly/MLY5y

  1. <a id=auto_play href=/>auto-play</a>
  2.  
  3. <script src=http://google.com/jsapi/></script>
  4. <script>google.load('jquery','1.4.2');</script>
  5.  
  6. <script>
  7. $(function(){
  8. $('#auto_play').click(function(){
  9.  
  10. // start from the beginning
  11. Coverflow.select(0);
  12.  
  13. // get total number of covers
  14. var canvasTotal = $('canvas').length;
  15. var newTotal = canvasTotal - canvasTotal;
  16.  
  17. // parse var, pass arg, and execute global
  18. function playFlow(){
  19. Coverflow.select(newTotal);
  20. runFlow(newTotal);
  21. };
  22.  
  23. // set to play
  24. function runFlow(){
  25. newTotal = newTotal + 1;
  26. if (newTotal > canvasTotal) {
  27. reverseFlow(newTotal);
  28. }
  29. else {
  30. Coverflow.select(newTotal);
  31. }
  32. };
  33.  
  34. // create reverse play
  35. function reverseFlow(newTotal){
  36. newTotal = newTotal - 1;
  37. Coverflow.select(newTotal);
  38. };
  39.  
  40. setInterval(playFlow, 2000);
  41. });
  42. });
  43. </script>

Report this snippet  

You need to login to post a comment.