Last active
August 20, 2019 13:56
-
-
Save davehax/6b6ab82ce1169df7f287823775841180 to your computer and use it in GitHub Desktop.
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
| // Works on desktop browsers only | |
| if (navigator.userAgent.match(/Trident\//) || navigator.userAgent.match(/Edge\//)) { | |
| document.body.addEventListener("mousewheel", function(evt) { | |
| evt.preventDefault(); | |
| var wd = evt.wheelDelta; | |
| var csp = window.pageYOffset; | |
| window.scrollTo(0, csp - wd); | |
| }); | |
| // If the code block above doesn't work, please try attaching the event to the window like so: | |
| // window.addEventListener("mousewheel", function(evt) { | |
| // evt.preventDefault(); | |
| // var wd = evt.wheelDelta; | |
| // var csp = window.pageYOffset; | |
| // window.scrollTo(0, csp - wd); | |
| // }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment