Last active
May 10, 2016 14:55
-
-
Save pilotgeraldb/8d7e35a38ad30df7e94a2868d7726321 to your computer and use it in GitHub Desktop.
javascript cross browser mouse wheel event registration
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
if (window.addEventListener) | |
{ | |
// IE9, Chrome, Safari, Opera | |
window.addEventListener("mousewheel", function (e) | |
{ | |
someEventHandler(e); | |
}, false); | |
// Firefox | |
window.addEventListener("DOMMouseScroll", function (e) | |
{ | |
someEventHandler(e); | |
}, false); | |
} | |
else | |
{ | |
// IE 6/7/8 | |
window.attachEvent("onmousewheel", function (e) | |
{ | |
someEventHandler(e); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment