On my website, I have implemented vertical scrolling without a scrollbar and one specific div also has horizontal scrolling without a scrollbar.
The code I am using is as follows:
(function() {
function scrollHorizontally(e) {
e = window.event || e;
var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
document.getElementById("premios-scroll").scrollLeft -= (delta * 40); // Multiplied by 40
document.getElementById("premios-scroll").scrollLeft -= (delta * 40); // Multiplied by 40
e.preventDefault();
}
if (window.addEventListener) {
// Works in IE9, Chrome, Safari, Opera
window.addEventListener("mousewheel", scrollHorizontally, false);
// Works in Firefox
window.addEventListener("DOMMouseScroll", scrollHorizontally, false);
}
else {
// For older browsers like IE 6/7/8
window.attachEvent("onmousewheel", scrollHorizontally);
}
})();
While the above code functions properly for horizontal scrolling, it unfortunately disables vertical scrolling on the webpage. You can view the website here.