Last active
July 12, 2017 15:48
-
-
Save hfknight/fd88a3b6b91872bf29abb17b604bb8d7 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
function MouseWheelHandler(e) { | |
var e = window.event || e; // old IE support | |
var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail))); | |
if (delta < 0) // scroll down | |
// scroll downaction here | |
else // scroll up | |
// scroll up action here | |
} | |
if (window.addEventListener) { | |
window.addEventListener("mousewheel", MouseWheelHandler, false); | |
window.addEventListener("DOMMouseScroll", MouseWheelHandler, false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment