开发者

jQuery hover is not catching all events when mouse is moved rapidly

开发者 https://www.devze.com 2022-12-16 06:48 出处:网络
I have binded jQuery hover to many elements on my page, and when I move mouse rapidly, hove will not cat开发者_如何转开发ch all events that should be fired. Is there any workaround for this \"feature\

I have binded jQuery hover to many elements on my page, and when I move mouse rapidly, hove will not cat开发者_如何转开发ch all events that should be fired. Is there any workaround for this "feature"?


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.


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).


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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消