jquery mouseout 和mouseleave区别

来源:互联网 发布:淘宝开企业店铺流程 编辑:程序博客网 时间:2024/05/22 11:59
不论鼠标指针离开被选元素还是任何子元素,都会触发 mouseout 事件。 

只有在鼠标指针离开被选元素时,才会触发 mouseleave 事件。 


The mouseleave event differs from mouseout in the way it handles event bubbling. If mouseout were used in this example, then when the mouse pointer moved out of the Inner element, the handler would be triggered. This is usually undesirable behavior. The mouseleave event, on the other hand, only triggers its handler when the mouse leaves the element it is bound to, not a descendant. So in this example, the handler is triggered when the mouse leaves the Outer element, but not the Innerelement.

官方文档

0 0
原创粉丝点击