Skip to content

Instantly share code, notes, and snippets.

@EminQasimov
Last active April 22, 2019 15:41
Show Gist options
  • Save EminQasimov/bad43e120c60c7b83fcc553d2ffa0863 to your computer and use it in GitHub Desktop.
Save EminQasimov/bad43e120c60c7b83fcc553d2ffa0863 to your computer and use it in GitHub Desktop.
60fps scrolling using pointer-events: none
/*
.disable-hover,
.disable-hover * {
pointer-events: none !important;
}
if you have many box-shadow elements or any animated elements
that cause of browser repaints
*/
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