Mozilla Firefox:显示/隐藏会触发鼠标悬停事件?
假设您有一个隐藏的
元素。它附加了一个 mouseover 事件,并且鼠标光标放置在
元素可见后将出现的位置。当
可见时,如何防止触发 mouseover 事件?Let's say you have a <div>
element which is hidden.
There is a mouseover event attached to it and the mouse cursor is placed at the location where the <div>
element will appear once it is visible.
How I can prevent the mouseover event from firing when the <div>
is made visible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能。当鼠标位于 Gecko 中的新元素上方时,无论是由于鼠标移动还是元素移动,都会触发该事件。这是很有目的的;当鼠标不移动时,它使得 CSS
:hover
之类的东西正常工作。You can't. The event is fired when the mouse is over a new element in Gecko, whether due to the mouse moving or elements moving. This is quite purposeful; it makes things like CSS
:hover
work correctly when the mouse is not moving.