Created
September 17, 2012 16:32
-
-
Save sonnyp/3738365 to your computer and use it in GitHub Desktop.
hide scrollbars
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
var hideScrollbars = function(aElement) { | |
if (aElement.clientWidth === aElement.offsetWidth) | |
return; | |
aElement.style.overflow = 'hidden'; | |
if ('onwheel' in scrollbox) { | |
scrollbox.addEventListener('wheel', function(e) { | |
this.scrollTop += e.deltaY; | |
this.scrollLeft += e.deltaX; | |
}); | |
} | |
else if ('onmousewheel' in scrollbox) { | |
scrollbox.addEventListener('mousewheel', function(e) { | |
this.scrollTop += e.wheelDeltaY; | |
this.scrollLeft -= e.wheelDeltaX; | |
}); | |
} | |
else { | |
//FIXME | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment