在界面中最多使用的是div,如果一个div中包含多个div或img对象时, 针对mouseout鼠标移出事件时,并没有移出div层,但是当移动到div中的img时,也触发了该mouseout事件,这就是事件冒泡的描述.
解决方法: 可以使用jquery bind可以阻止浏览器的一些默认行为.
部分代码:
$(".buy").mouseout(function(){
$(this).hide();
});
改成: $(".buy").bind("mouseleave", function() {
$(this).hide();
});
将问题解决.(使用mouseleave替代mouseout、用mouseenter替代mouseover)
相关文章:
-
2021-12-04
-
2022-12-23
-
2021-12-17
-
2021-12-17
-
2021-07-18
猜你喜欢
-
2022-12-23
-
2022-12-23
-
2021-08-26
-
2021-12-17
-
2021-12-17
-
2021-04-24
相关资源
-
下载
2021-06-24
-
下载
2022-12-04
-
下载
2023-03-15
-
下载
2022-12-03
-
下载
2021-06-05