jquery 事件继续执行,我希望它只执行一次 运行

jquery Event keeps executing, I want it to run only once

伙计们,我只需要你的帮助来执行此代码一次,每次我将鼠标悬停在浏览器上时它都会重复 window。

<script>
  $(function () {
    function myEvent(obj, evt, fn) {
      {
        obj.addEventListener(evt, fn, false);
      }
    }

    myEvent(document, "mouseleave", function (a) {
      var from = a.relatedTarget;
      if (a.pageY < $(window).scrollTop()) {
        $("#bounceModal").addClass("ffb-show");
      }
    });
  });
</script>

{once:true}传给.addEventListener()的第三个参数

  function myEvent(obj, evt, fn) {
    obj.addEventListener(evt, fn, {once:true});
  }