<div id="xinwen_bottom" class="xinwen_bottom"> <div id="xinwen_msg_bground" class="xinwen_msg_bground"></div> <div id="xinwen_msg" class="xinwen_msg"> <div id="xinwen_msg_left" class="xinwen_msg_left"> <a id="xinwen_desc" class="xinwen_desc"> <strong>版权法规有变</strong> </a> </div> <div id="xinwen_msg_right" class="xinwen_msg_right"> <a href="#" onclick="return false"><img class="tiny_img" num=6 class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="pic/news/circle.jpg" onmouseover="news_tiny_selector(6)"></a> <a href="#" onclick="return false"><img class num=5 class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="pic/news/circle.jpg" onmouseover="news_tiny_selector(5)"></a> <a href="#" onclick="return false"><img class num=4 class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="pic/news/circle.jpg" onmouseover="news_tiny_selector(4)"></a> <a href="#" onclick="return false"><img class num=3 class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="pic/news/circle.jpg" onmouseover="news_tiny_selector(3)"></a> <a href="#" onclick="return false"><img class num=2 class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="pic/news/circle.jpg" onmouseover="news_tiny_selector(2)"></a> <a href="#" onclick="return false"><img class num=1 class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="pic/news/circle.jpg" onmouseover="news_tiny_selector(1)"></a> </div> </div> </div>
html代码如上、现准备做一个当鼠标悬停在xinwen_bottom时候画面不执行Interval,当鼠标移出xinwen_bottom时候继续执行setInterval时间进行图片轮播,之前的代码如下:
$("div.xinwen_bottom").mouseout(function(){ alert(1); });
发现无限触发mouseout。
查阅后发现,mouseout不仅作用于本元素,还作用于子元素和孙元素,所以会无限触发。改用mouseleave后问题解决
$("div.xinwen_bottom").mouseleave(function(){ alert(1); });
小结:mouseout作用于本元素和子元素以及孙元素。mouseleave仅作用于本元素。
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦