javascript - jQuery 的 mouseout() 和 mouseleave() 有什么区别?

标签 javascript jquery mouseout mouseleave

jQuery 的 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 Inner element.

来源:http://api.jquery.com/mouseleave/

关于javascript - jQuery 的 mouseout() 和 mouseleave() 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4258615/

相关文章:

javascript - 在Docusign Node SDK中调用envelopesApi.getDocument时,返回的数据是什么格式?如何将其写入文件?

javascript - IE7下拉菜单

javascript - 如何在数据表中的 ajax 调用下次单击时发送自定义 header ?

css - 悬停前后不同的CSS样式

javascript - 根据该对象中其他两个属性的值获取 Javascript 对象属性的值

javascript - firefox 和 radialgradient(使用 html5 Canvas )

javascript - 使用纯 JavaScript 显示更多/显示更少多个元素的切换按钮 [无 jQuery]

javascript - jQuery 追加文本格式

javascript - 防止子节点的 mouseout 事件

jquery - 令人困惑的鼠标移开行为