Skip to content

Instantly share code, notes, and snippets.

@sonnyp
Created September 17, 2012 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sonnyp/3738365 to your computer and use it in GitHub Desktop.
Save sonnyp/3738365 to your computer and use it in GitHub Desktop.
hide scrollbars
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