Exit pop up with javascript
-
Hi,
I trying to display some content as a pop up to users that are about to leave my site.
I have been doing some research and found this code:
document.addEventListener("mouseleave", function(e){ if( e.clientY < 0 ) { alert("Hey don't leave. I have an free eBook for you"); } }, false);
But the problem is that this show the pop up as an alert.
Now my question is: can I modify the above code so it displays this hidden content instead of the alert: <div=”popUp”></div>
My Javascript skills are very limited so please explain things the way you would to a beginner. Thanks.
(If this is not the right sub-forum, I apologize and ask that it be moved to the right sub-forum.)
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Exit pop up with javascript’ is closed to new replies.