siuri
siuri

Reputation: 191

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.

Upvotes: 0

Views: 25

Answers (1)

Sterling
Sterling

Reputation: 36

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');
  }
});

Upvotes: 1

Related Questions