[英]Why is onMouseOver event fired when the mouse only moves into an inner element?
When the mouse hovers into the inner element, the mouseOut
event for the outer element is fired first, then the mouseOver
element for inner element is fired, then the mouseOver
element for the inner element is fired last.当鼠标悬停到内元件中,
mouseOut
用于外部元件事件首先被烧成,则mouseOver
于内部元件部件发射,那么mouseOver
用于内部元件元件最后烧制。
Why does this happen?为什么会发生这种情况? Because the inner element technically is still inside of the outer element, so the mouse doesn't leave the outer element when it moves into the inner element.
因为技术上内部元素仍然在外部元素的内部,所以当鼠标移入内部元素时,它不会离开外部元素。 Is there a way to prevent that?
有没有办法防止这种情况?
Full example here: http://jsfiddle.net/pMCeu/4/完整示例: http : //jsfiddle.net/pMCeu/4/
Hi the solution above is correct and complete.嗨,上述解决方案是正确且完整的。 but you can also use mousemove event
但你也可以使用 mousemove 事件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.