Skip to content

Instantly share code, notes, and snippets.

@elfacht
Created January 5, 2022 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elfacht/8c9e9730b350ab4bfaab9edfd39f8f9e to your computer and use it in GitHub Desktop.
Save elfacht/8c9e9730b350ab4bfaab9edfd39f8f9e to your computer and use it in GitHub Desktop.
Disable mouseover while scrolling
const body = document.body;
let 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')
}, 100);
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment