2016-05-17 4 views
0

私は出口ポップアップを既に持っていますが、サイトページを下にスクロールすると再び表示されません。私が問題を見つけるのを助けてください。私は本当に何が間違っているのか分からない。悪い英語出口ポップアップが正しく動作しません

<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> 

答えて

2

のため申し訳ありません ウェルTHXは、問題がある

if(e.pageY <= 5) 

にあなたが必要なので...スクロール後e.pageY <= 5をキャッチすることはできません

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

Demo Here

+0

あなたに大きな感謝、今それは動作します! –

+0

あなたはまったく歓迎です@HenrikusAnthony .. Good Luck :) –

関連する問題