Created
January 5, 2022 10:48
-
-
Save elfacht/8c9e9730b350ab4bfaab9edfd39f8f9e to your computer and use it in GitHub Desktop.
Disable mouseover while scrolling
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
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