Last active
August 29, 2015 14:02
-
-
Save t0mtaylor/535741f5aa5f29dda922 to your computer and use it in GitHub Desktop.
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 and enable event on scroll begin and scroll end. | |
* | |
* Quick tidy, auto for active hover styles, and set in self executing method | |
* Check for addEventListener, don't bother with IE8 and older browsers | |
* Tom Taylor - 03/06/14 - http://tommytaylor.co.uk | |
* | |
* @see http://www.thecssninja.com/javascript/pointer-events-60fps | |
*/ | |
(function(w, d) { | |
var doc = d.documentElement || d.body, | |
timer; | |
if (w.addEventListener) { | |
w.addEventListener('scroll', function() { | |
w.clearTimeout(timer); | |
if(!doc.style.pointerEvents) { | |
doc.style.pointerEvents = 'none'; | |
} | |
timer = w.setTimeout(function() { | |
doc.style.pointerEvents = 'auto'; | |
}, 200); | |
}, false); | |
} | |
})(window, document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment