Skip to content

Instantly share code, notes, and snippets.

@violetyk
Last active August 4, 2020 05:11
  • Star 13 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
スクロールイベント 上下方向の判定
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