Henrikus Anthony Henrikus Anthony - 1 year ago 137
HTML Question

Exit PopUp doesn't work properly

So guys, I have an exit PopUp it already worked but when I scroll down the site page down, it can't appear again. please help me find the problem. I really don't know what's wrong.
well thx, sorry for bad English

<script type="text/javascript" src="asset/jquery.min.js"></script>
<script type="text/javascript">
$(document).mousemove(function(e) {
$('#exitpopup').css('left', (window.innerWidth/2 - $('#exitpopup').width()/2));
$('#exitpopup').css('top', (window.innerHeight/2 - $('#exitpopup').height()/2));
if(e.pageY <= 5)
// Show the exit popup

<style type="text/css">
#exitpopup h1{
#exitpopup p{
<div style="display: none; width:100%; height:100%; position:fixed; background:black; opacity: .3; filter:alpha(opacity=0.8); z-index:999998;" id="exitpopup_bg">

<div style="width:50%; height:auto; margin:0px auto; display:none;position:fixed; color:#ffffff; padding:20px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; z-index:999999;" id="exitpopup">
<img src="asset/PopUp.png" />

Answer Source

The problem is in

if(e.pageY <= 5)

you can't catch the e.pageY <= 5 after scroll .. so you need

if(e.pageY - $(window).scrollTop() <= 5)

Demo Here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download