如何避免大规模的onmouseover onmouseout射击? [英] How do I avoid massive onmouseover onmouseout firing?

查看:128
本文介绍了如何避免大规模的onmouseover onmouseout射击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,有一些列。每个人都是一张照片,其中有一个onmouseover / onmouseout事件,它显示了一个div中的消息并隐藏消息。



我的问题是,之后一个用户从左到右快速移动很多图像,所有的鼠标悬停和鼠标悬停事件的图像被执行,这看起来很愚蠢...



是否可以重新排列内部事件堆栈以避免这种情况,以便用户仅执行当前事件(大多数是第一个事件),然后执行最后一个事件(如果不是相同的类型)。



例如,如果第一个图像上的鼠标悬停执行,并且鼠标移动位置在第一个图像旁边停止三次以上的图像。我可以避免所有其他事件触发,因为鼠标停在图像上,鼠标悬停就像我用鼠标停止的那样。



我如何避免这个多重事件触发?

解决方案

您需要查看 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆