小编J.J*_*J.J的帖子

单击事件会影响 chrome 上的 mouseenter 和 mouseleave,这是一个错误吗?

添加mouseenter和mouseleave事件后,点击元素(点击次数不确定)?mouseenter和mouseleave会被触发。

我尝试了 chrome 62.0.3202.94?32??firework?IE,它只发生在 chrome 上。这是 chrome 的错误吗?或者只是我的代码有问题?

在线示例:http : //runjs.cn/code/cbb0aw1a

代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h4>click on the parent part,then see the console </h4>
<div class="parent" style="width: 100%;height: 100px;background-color: #ddd">
    <div class="children" style="width: 50px;height: 50px;background-color: #d9534f;cursor: pointer">
        test
    </div>
</div>
</body>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
<script>
    $(".parent").mouseenter(function () {
        console.log("enter")
    }).mouseleave(function () {
        console.log("leave")
    });

</script>
</html>
Run Code Online (Sandbox Code Playgroud)

google-chrome click mouseenter mouseleave

5
推荐指数
1
解决办法
1526
查看次数

标签 统计

click ×1

google-chrome ×1

mouseenter ×1

mouseleave ×1