Skip to content

Instantly share code, notes, and snippets.

@hkfoster
Last active January 2, 2016 22:59
Show Gist options
  • Save hkfoster/8373043 to your computer and use it in GitHub Desktop.
Save hkfoster/8373043 to your computer and use it in GitHub Desktop.
Disable hover events on scroll.
/**
* Disable hover events on scroll
* @see http://www.thecssninja.com/javascript/pointer-events-60fps
*/
var root = document.documentElement, timer;
window.addEventListener( 'scroll', function() {
clearTimeout( timer );
if ( !root.style.pointerEvents ) {
root.style.pointerEvents = 'none';
}
timer = setTimeout(function() {
root.style.pointerEvents = '';
}, 150 );
}, false );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment