jQuery中mouseout和mouseleave区别
jQuery中mouseout和mouseleave区别
<body> <div id="box1"> <div id="box2"></div> </div> <script src="jquery.js"></script> <script> let box1 = $(‘#box1‘); let box2 = $(‘#box2‘); ? box1.on({ mouseout:function(){ console.log(‘mouseout‘); //不论鼠标指针离开指定元素还是该元素子元素,都会触发 mouseout 事件。 }, mouseleave:function(){ console.log(‘mouseleave‘); //只有在鼠标指针离开指定元素时,才会触发 mouseleave 事件。 }, }) </script> </body>
总结
个人感觉mouseleave()最大的好处就是不冒泡
相关推荐
84483065 2020-09-11
85477104 2020-08-15
83510998 2020-08-08
tztzyzyz 2020-07-05
delmarks 2020-06-28
89510194 2020-06-27
牵手白首 2020-06-14
tztzyzyz 2020-05-31
81463166 2020-05-17
88570299 2020-05-17
delmarks 2020-05-17
donghongbz 2020-05-15
tztzyzyz 2020-05-15
<table id="table" class="table table-striped table-bordered table-hover table-nowrap" width="100%&qu
牵手白首 2020-05-14
Chriswang 2020-04-30
83510998 2020-05-03