Created
January 6, 2022 09:54
-
-
Save dineshdeveloper1/ef94aa9e0a2337c37607d543672f15da to your computer and use it in GitHub Desktop.
Event Listener - when leaving page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to detect when mouse pointer leaves viewport | |
document.addEventListener("mouseleave", function(e){ | |
if( e.clientY < 0 ) | |
{ | |
alert("Hey don't leave. we have some offer for you"); | |
} | |
}, false); | |
//for more detail- http://qnimate.com/exit-intent-using-javascript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment