Skip to content

Instantly share code, notes, and snippets.

@leek
Created December 4, 2013 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leek/7793982 to your computer and use it in GitHub Desktop.
Save leek/7793982 to your computer and use it in GitHub Desktop.
/**
* Disable and enable event on scroll begin and scroll end.
* @see http://www.thecssninja.com/javascript/pointer-events-60fps
*/
(function(r, t) {
window.addEventListener('scroll', function() {
// User scrolling so stop the timeout
clearTimeout(t);
// Pointer events has not already been disabled.
if (!r.style.pointerEvents) {
r.style.pointerEvents = 'none';
}
t = setTimeout(function() {
r.style.pointerEvents = '';
}, 500);
}, false);
})(document.documentElement);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment