I want to be able to scroll through the whole page, but without the scrollbar being shown.
In Google Chrome it\'s:
::-webkit-scrollbar {
display:
Another sort of hacky approach is to do overflow-y: hidden
and then manually scroll the element with something like this:
function detectMouseWheelDirection(e) {
var delta = null, direction = false;
if (!e) { // If the event is not provided, we get it from the window object
e = window.event;
}
if (e.wheelDelta) { // Will work in most cases
delta = e.wheelDelta / 60;
} else if (e.detail) { // Fallback for Firefox
delta = -e.detail / 2;
}
if (delta !== null) {
direction = delta > 0 ? -200 : 200;
}
return direction;
}
if (element.addEventListener) {
element.addEventListener('DOMMouseScroll', function(e) {
element.scrollBy({
top: detectMouseWheelDirection(e),
left: 0,
behavior: 'smooth'
});
});
}
There's a great article about how to detect and deal with onmousewheel
events in deepmikoto's blog.
This might work for you, but it is definitively not an elegant solution.