Created
May 19, 2016 16:46
-
-
Save carolina-vallejo/b4a7a55da2606a16702d9993e57d3787 to your computer and use it in GitHub Desktop.
detect-scroll-up-down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var m_lastScrollTop = 0; | |
$(window).scroll(function() { | |
var m_getscroll = $(window).scrollTop(); | |
//Scroll UP & DOWN | |
m_getscroll = m_getscroll; | |
if (m_getscroll > m_lastScrollTop) { //-----------DOWN | |
console.log('pa abajo'); | |
} else { //-----------UP | |
console.log('pa arriba!!!'); | |
} | |
m_lastScrollTop = m_getscroll; | |
}); //---scroll |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment