退出弹出窗口';工作不正常


Exit PopUp doesn't work properly

伙计们,我有一个出口弹出窗口,它已经起作用了,但当我向下滚动网站页面时,它就不能再出现了。请帮我找出问题所在。我真的不知道怎么了。嗯,抱歉英语不好

<script type="text/javascript" src="asset/jquery.min.js"></script>
<script type="text/javascript">
      $(function(){
        $(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
                $('#exitpopup_bg').fadeIn();
                $('#exitpopup').fadeIn();
            }
        });
        $('.close').click(function(){
        $('#exitpopup_bg').fadeOut();
            $('#exitpopup').fadeOut();
    });
        $('#exitpopup_bg').click(function(){
            $('#exitpopup_bg').fadeOut();
            $('#exitpopup').slideUp();
        });
    });
</script>
<style type="text/css">
    #exitpopup{
        text-align:center;
    }
    #exitpopup h1{
        margin-top:0px;
        padding-top:0px;    
    }   
    #exitpopup p{
        text-align:left;
    }
</style>
<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>
    <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" />           
</div>

问题出在中

if(e.pageY <= 5)

滚动后无法捕捉到e.pageY <= 5。。所以你需要

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

此处演示