This would be easy. setInterval returns in ID handle to that particular
interval.

Your code would change to: ( Make sure to declare var intervalID in the
global scope )

intervalID = setInterval (.... )

Then use onmouseOver and onmouseOut events to control the interval

onMouseOver="stopInterval(intervalID)"

onMouseOut="intervalID = setInterval( ... )"


Ralph Brickley
Owner


435 NE Evans St Ste 115  -  P.O. Box 510  McMinnville, OR 97128
(503) 583-1830 Cell  |  (503) 472-7914 Office  |  (800) 986-0276 Fax
www.topsoftdesignstudio.com

-----Original Message-----
From: a1anm [mailto:alanmoor...@gmail.com] 
Sent: Monday, January 04, 2010 2:53 PM
To: Prototype & script.aculo.us
Subject: [Proto-Scripty] Pause on MouseOver

I'm using this simple slideshow and wondered if anyone knew how to make it
pause when I moved my mouse over it and then start again if I move my mouse
off the image?

There is a demo of the slideshow here:
http://script.aculo.us/stuff/simplest_slideshow/

This is the main code:

<script>
setInterval(function(){
  var imgs = $$('.fadein img'),
   visible = imgs.findAll(function(img){ return img.visible(); });
  if(visible.length>1) visible.last().fade({ duration: 1 });
    else imgs.last().appear({ duration: 1,
      afterFinish: function(){ imgs.slice(0,imgs.length-1).invoke
('show');  } });
}, 2000);
</script>

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.


Reply via email to