标签:box block span src let log jquer query data
1 <body> 2 <div id="box1"> 3 <div id="box2"></div> 4 </div> 5 <script src="jquery.js"></script> 6 <script> 7 let box1 = $(‘#box1‘); 8 let box2 = $(‘#box2‘); 9 ? 10 box1.on({ 11 mouseout:function(){ 12 console.log(‘mouseout‘); //不论鼠标指针离开指定元素还是该元素子元素,都会触发 mouseout 事件。 13 }, 14 mouseleave:function(){ 15 console.log(‘mouseleave‘); //只有在鼠标指针离开指定元素时,才会触发 mouseleave 事件。 16 }, 17 }) 18 </script> 19 </body>
个人感觉mouseleave()最大的好处就是不冒泡
标签:box block span src let log jquer query data
原文地址:https://www.cnblogs.com/ayong6/p/12163185.html