I have a pop up code written in my project. Simple I was using fading effect when mousemove. Bootstrap modal
was showing perfectly on mousemove
but I need to show modal when user closes the browser tab or leave the page. Below is my code
Before
$(document).on("mousemove", function (e) {
$('#exitpopup').css('top', (window.innerHeight / 2 - $('#exitpopup').height() / 2));
if (abc) {
if (e.pageY >= 5) {
abc = false;
// Show the exit popup
$('#exitpopup_bg').fadeIn();
$('#exitpopup').fadeIn();
abc = 0;
}
}
});
Above code is working fine but how could I use fadeIn
in below code or suggest me any other way please.
window.addEventListener("beforeunload", function (e) {
var confirmationMessage = "\o/";
(e || window.event).returnValue = confirmationMessage; //Gecko + IE
return confirmationMessage; //Webkit, Safari, Chrome
});