Pause "rotating" images on mouse over

Pause "rotating" images on mouse over

Hi,

I currently have a loop of images showing up on the bottom of the screen after various intervals, and the only thing left i need to do is to pause this temporarily whilst the mouse is hovering over the current image.

Heres the code so far;
  1. var InfiniteRotator =
  2.     {
  3.         init: function()
  4.         {
  5.             // initial fade-in time
  6.             var initialSlideIn = 1000; 
  7.             // interval between items
  8.             var itemInterval = 12000; 
  9.             // cross-fade time
  10.             var slideTime = 800;
  11.     // create image variable
  12.     var img = $('#HIBanners img');
  13.             // count number of items
  14.             var numberOfItems = img.length; 
  15.             // set current item
  16.             var currentItem = 0; 
  17.             // show first item
  18.             img.eq(currentItem).animate({ bottom: '0'}, initialSlideIn);
  19. // mouse over effects
  20. img.mouseover(function() {
  21. img.eq(currentItem).animate({bottom: '-1'}, 0);
  22. });
  23. img.mouseout(function() {
  24. img.eq(currentItem).animate({bottom: '0'}, 0);
  25. });

  26. // loop through the items
  27. var infiniteLoop = setInterval(function()
  28. {
  29. img.eq(currentItem).animate({ bottom: '-80'}, slideTime);

  30. if(currentItem == numberOfItems - 1) {
  31. currentItem = 0;
  32. } else {
  33. currentItem++;
  34. }
  35. img.eq(currentItem).delay(2000).animate({ bottom: '0'}, slideTime);
  36.  
  37. }, itemInterval);
  38.         }
  39.     }; 
  40.     InfiniteRotator.init();
This basically does this;
animate the first image up from the bottom.
wait 10 seconds
slide down that image
wait 2 seconds
slide up the next image.
etc..

there is a mouse over effect to lower the image by 1 pixel.

I've tried such things as setting a variable on mouse over, then applying if statements to the infiniteLoop. That didnt work, and ive looked around for similar problems and cant seem to find one.


I'm guessing i might have to do something with a timer maybe?
Hopefully someone can offer me a solution.

Thanks