简体   繁体   中英

Modal Popup on Window exit - resets one time

I would like to use only one time modal when a user leaves on the Window.

$(document).mousemove(function(e) { if (e.clientY <= 1) { //Modal } }); Let me know how can I create it.

Assuming that you already have the modal element created in your HTML then I think this should do what you want...

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM