如何避免大规模的onmouseover onmouseout射击? [英] How do I avoid massive onmouseover onmouseout firing?
问题描述
我的问题是,之后一个用户从左到右快速移动很多图像,所有的鼠标悬停和鼠标悬停事件的图像被执行,这看起来很愚蠢...
是否可以重新排列内部事件堆栈以避免这种情况,以便用户仅执行当前事件(大多数是第一个事件),然后执行最后一个事件(如果不是相同的类型)。
例如,如果第一个图像上的鼠标悬停执行,并且鼠标移动位置在第一个图像旁边停止三次以上的图像。我可以避免所有其他事件触发,因为鼠标停在图像上,鼠标悬停就像我用鼠标停止的那样。
我如何避免这个多重事件触发?
您需要查看 hoverIntent 插件,解决了这个问题。
I have a table with some columns. In each of them is a picture where I have an onmouseover/onmouseout event on it, which shows a message in a div and hides the message.
My problem is, after a user moves quickly from left to right over a lot of images, all mouseover and mouseout events of the images are executed, which looks stupid...
Is it possible to rearrange the internal event stack to avoid this, such that the user executes only the current event (mostly the first one) and then the last one, if it is not the same type?
For example, if mouseover over first image is executed and the mouse moving position stops over an image three times next to the first one. I can avoid all other events firing, because the mouse stopped over an image and the mouseover is like the one where I stopped with the mouse.
How can I avoid this multiple event firing?
You need to check out the hoverIntent plugin, which addresses this problem.
这篇关于如何避免大规模的onmouseover onmouseout射击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!