Skip to content

Instantly share code, notes, and snippets.

@schonert
Created November 4, 2013 22:35
Show Gist options
  • Save schonert/7310408 to your computer and use it in GitHub Desktop.
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
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