views:

72

answers:

3

I have binded jQuery hover to many elements on my page, and when I move mouse rapidly, hove will not catch all events that should be fired. Is there any workaround for this "feature"?

+2  A: 

It's a deeper problem than you think. When you move the mouse rapidly, it doesn't exist on all points along the path from a to b, and will skip over pixels.

I don't know of any way to interpolate the data from the mouse position and send that to jQuery as a sequence of hover events, but that would be what you'd have to do to make this work the way you expect it to.

This mouse rate checker might give you a bit more insight into the problem.

Skilldrick
Seconded. If the browser and JQuery are not catching an event, it's likely no one can. Many programs (drawing programs especially) use interpolation to account for the missing points on the mouse cursor's path.
Pekka
A: 

Bind "hover" to one big 'canvass' element - something that contains all the rest, then analyze the coordinates and elements it should have hit on route between the event firing. This is a horrible work (you need to create a map of all active elements and use vector crossing finding algorithms to find intersections of route and elements) but about the only that will work. Otherwise, just reduce the number of elements with the event or redesign the interface... or use a faster computer (all clients).

SF.
A: 

HoverIntent jQuery plugin solved my issue. Thanx for all answers!!!

http://cherne.net/brian/resources/jquery.hoverIntent.html

newbie