script.js 564 B

12345678910111213141516171819202122232425262728
  1. $(function(){
  2. setInterval(function(){
  3. $('#pacman').toggleClass('pacman_eats');
  4. }, 300);
  5. // speed in milliseconds
  6. var scrollSpeed = 20;
  7. var bgscroll = '';
  8. // set the direction
  9. var direction = 'h';
  10. // set the default position
  11. var current = 0;
  12. //Calls the scrolling function repeatedly
  13. setInterval(function(){
  14. // 1 pixel row at a time
  15. current -= 1;
  16. // move the background with backgrond-position css properties
  17. $('body').css("backgroundPosition", (direction == 'h') ? current+"px 0" : "0 " + current+"px");
  18. }, scrollSpeed);
  19. });