窗口退出时的模式弹出窗口 - 重置一次

Modal Popup on Window exit - resets one time

本文关键字:窗口 一次 退出 模式      更新时间:2023-09-26

当用户离开窗口时,我只想使用一次时间模态。

$(document).mousemove(function(e) { if (e.clientY <= 1) { //Modal } }); 让我知道如何创建它。

假设您已经在 HTML 中创建了模态元素,那么我认为这应该可以满足您的需求......

$(document).mousemove(function(e) {
  if (e.clientY <= 1 && modalShown != 1) {
    modalShown = 1;
    $('#myModal').modal('show');
  }
});