search

Home  >  Q&A  >  body text

javascript - Continuous clicks trigger mouseleave event

<!DOCTYPE html>
<html>

<head lang="en">
  <meta charset="UTF-8">
  <title>test</title>
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>

<body>
  <p class="main" style="width:100px;height: 200px;background: red;"></p>
  <script>
    $(".main").mouseleave(function() {
      alert(0)
    })
  </script>
</body>

</html>

At first I thought it was a conflict with the click event in .main, but I found that continuous clicks of the mouse will also trigger the mouseleave event.

Please tell me if you have any solution.

黄舟黄舟2746 days ago1085

reply all(2)I'll reply

  • 某草草

    某草草2017-07-05 10:39:55

    My continuous mouse clicks here did not trigger the mouseleave event. You can put the code to see http://runjs.cn/code

    reply
    0
  • 为情所困

    为情所困2017-07-05 10:39:55

    If you simply click the left button continuously, there is no problem, but if you click the right button or alternate left and right, some situations may occur because the menu is called out

    reply
    0
  • Cancelreply