shadenite
2008-Mar-27 22:07 UTC
mouseover & mousout triggered numerous times as the mouse moves...
I have a script that loops through an array of divs that adds a mouseover/mousout event listener to each. However, I am finding that as I move my mouse around within any of these divs that the mouseover and mouseout constantly fires. This wasn''t initially an issue (there is no flickering or no noticeable side effects) until I tried to add a time delay. I tried using event.stop() at the end of the mouseover and mouseout and also tried setting the useCapture parameter on observe to true. No luck. It seems like I may be missing something fundamental. If anyone could share their thoughts, I would really appreciate it. My code boils down to this: function setupThumbnails() { $$(''div.myClassName'').each(function(div) { div.observe(''mouseover'', function(event) { ...do some stuff.... event.stop(); }, true); div.observe(''mouseout'', function(event) { ...do some stuff... event.stop(); }, true); }); } Event.observe(window, ''load'', setupThumbnails, true); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---