小仙儿 2020-01-07
<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()最大的好处就是不冒泡
<table id="table" class="table table-striped table-bordered table-hover table-nowrap" width="100%&qu