Last active
January 2, 2016 22:59
-
-
Save hkfoster/8373043 to your computer and use it in GitHub Desktop.
Disable hover events on scroll.
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
/** | |
* 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