2017-07-25 12 views
0

私のウェブサイトでは、スティッキーヘッダーを作成しました。ScrollTopバグjquery On chrome

それはすべてのブラウザで非常にうまく動作しますが、私はChromeでのMacBook上でテストしたときに、私は私のメインヘッダとスティッキーヘッダをしましたscrollTop

でバグがあります:

私はこのコード:

$(document).on('scroll',function() {  
    if ($(document).scrollTop() >= 150) { 
     $('header:not(.sticky)').hide(); 
     $('header.sticky').show(); 
    } else { 
     $('header:not(.sticky)').show(); 
     $('header.sticky').hide(); 
    } 
}); 

150pxにスクロールすると、ページの先頭にジャンプします。

ありがとうございました!

答えて

0

これは、Macマシン

$(document).scroll(()=> { 
    if($(this).scrollTop()>= 150) { 
     //Your Actions 
    } 
    else { 
     //Your Actions 
    } 
    }); 
にChromeで正常に動作します
関連する問題