Skip to content

Instantly share code, notes, and snippets.

@pilotgeraldb
Last active May 10, 2016 14:55
Show Gist options
  • Save pilotgeraldb/8d7e35a38ad30df7e94a2868d7726321 to your computer and use it in GitHub Desktop.
Save pilotgeraldb/8d7e35a38ad30df7e94a2868d7726321 to your computer and use it in GitHub Desktop.
javascript cross browser mouse wheel event registration
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