Skip to content

Instantly share code, notes, and snippets.

@LaloHao
Last active September 3, 2021 19:05
Show Gist options
  • Save LaloHao/f813175d5e67fde6f69a4148f4383228 to your computer and use it in GitHub Desktop.
Save LaloHao/f813175d5e67fde6f69a4148f4383228 to your computer and use it in GitHub Desktop.
Disable smooth trolling (scrolling) on websites
// source: http://stackoverflow.com/a/35611393/992504
document.addEventListener("wheel", event => event.stopPropagation(), true);
// document.addEventListener("wheel", event => event.stopPropagation(), { capture: true });
/*
document.getElementsByTagName("body")[0].addEventListener("wheel",function (event) {
// exception for ACE Editor, JS text editor used by sites like GitHub
if (event.target.classList.contains('ace_content')) {
return;
}
event.stopPropagation();
}, true);
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment