Last active
August 29, 2015 14:01
-
-
Save msherstobitow/764f364539e55bc44a0f to your computer and use it in GitHub Desktop.
Web page perfomance: remove pointer-events on page scroll.
This file contains hidden or 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, | |
.disable-hover * { | |
pointer-events: none !important; | |
} |
This file contains hidden or 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
var body = document.body, | |
timer; | |
window.addEventListener('scroll', function() { | |
clearTimeout(timer); | |
if(!body.classList.contains('disable-hover')) { | |
body.classList.add('disable-hover') | |
} | |
timer = setTimeout(function(){ | |
body.classList.remove('disable-hover') | |
},500); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment