jquery悬停仅在悬停一定时间后才起作用
在链接列表中,我只想在用户将鼠标悬停在该链接上一定时间(例如 1 秒)后激活这些链接的悬停行为。因此,如果他们碰巧只是经过链接(不到一秒),我不希望发生悬停事件。
有谁知道如何做到这一点或有任何这方面的例子吗? 谢谢!
In a list of links, I only want to activate the hover behavior for those links after the person is hovering over that link for a certain amount of time (say 1 second). So if they happen to just pass over the link (for less than one second) I don't want the hover event to occur.
Does anyone know how to do this or have any examples of this?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,有一个名为 hoverIntent 的 jQuery 插件,它可以执行您所描述的操作。
Yes, There is a plugin for jQuery called hoverIntent that does what you describe.
我强烈建议使用 hover Intent jquery 插件。它之前为我解决了这个问题,并且看起来写得很好而且很轻松。
I highly recomend using the hover intent jquery plugin for this. It's solved this problem for me before and seems to be very well written and light.
您可以在悬停链中使用延迟:
http://api.jquery.com/delay/
还有一个名为“hoverIntent”的插件,如果允许的话我会将您链接到该插件。
You can use delay in your hover chain:
http://api.jquery.com/delay/
There is also a plugin called "hoverIntent" which I would link you to if I was allowed.