Skip to content

Instantly share code, notes, and snippets.

@syuichi-tsuji
Forked from violetyk/gist:5343883
Last active February 23, 2018 12:51
Show Gist options
  • Save syuichi-tsuji/ea387588c834bcc23c96 to your computer and use it in GitHub Desktop.
Save syuichi-tsuji/ea387588c834bcc23c96 to your computer and use it in GitHub Desktop.
スクロールイベント 上下方向の判定
var start_pos = 0;
$(window).scroll(function(e){
var current_pos = $(this).scrollTop();
if (current_pos > start_pos) {
console.log('down');
} else {
console.log('up');
}
start_pos = current_pos;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment