Skip to content

Instantly share code, notes, and snippets.

@hbsnow
Last active December 12, 2015 08:49
Show Gist options
  • Save hbsnow/4746515 to your computer and use it in GitHub Desktop.
Save hbsnow/4746515 to your computer and use it in GitHub Desktop.
jQuery を使ったスクロールバーの top からの位置による条件分岐
$(window).scroll(function(){
var scroll_top = document.body.scrollTop || document.documentElement.scrollTop || document.scrollY || 0;
if(scroll_top > 30){
//ブラウザのスクロールバーが30pxより下に行った場合
}
if(scroll_top <= 30){
//ブラウザのスクロールバーが30pxより上に行った場合
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment