Created
November 4, 2013 22:35
-
-
Save schonert/7310408 to your computer and use it in GitHub Desktop.
Determines rather the user is scrolling or not.
Useful for breaking out of scrolling animations
This file contains 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 userScroll = false; | |
function mouseEvent(e) { | |
// Programic scroll has no event | |
if( typeof e === 'object') | |
userScroll = true; | |
else | |
userScroll = false; | |
} | |
// detect user scroll through mouse | |
if(window.addEventListener) | |
document.addEventListener('DOMMouseScroll', mouseEvent, false); // Mozilla/Webkit | |
else | |
document.onmousewheel = mouseEvent; //for IE/OPERA etc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment