How to hide scrollbar in Firefox?
You can use the scrollbar-width
rule. You can scrollbar-width: none;
to hide the scrollbar in Firefox and still be able to scroll freely.
body {
scrollbar-width: none;
}
To hide scroll bar on Chrome, Firefox and IE you can use this:
.hide-scrollbar
{
overflow: auto;
-ms-overflow-style: none; /* IE 11 */
scrollbar-width: none; /* Firefox 64 */
}
I was able to hide the scrollbar but still be able to scroll with mouse wheel with this solution:
html {overflow: -moz-scrollbars-none;}
Download the plugin https://github.com/brandonaaron/jquery-mousewheel and include this function:
jQuery('html,body').bind('mousewheel', function(event) {
event.preventDefault();
var scrollTop = this.scrollTop;
this.scrollTop = (scrollTop + ((event.deltaY * event.deltaFactor) * -1));
//console.log(event.deltaY, event.deltaFactor, event.originalEvent.deltaMode, event.originalEvent.wheelDelta);
});
This is what I needed to disable scrollbars while preserving scroll in Firefox, Chrome and Edge in :
@-moz-document url-prefix() { /* Disable scrollbar Firefox */
html{
scrollbar-width: none;
}
}
body {
margin: 0; /* remove default margin */
scrollbar-width: none; /* Also needed to disable scrollbar Firefox */
-ms-overflow-style: none; /* Disable scrollbar IE 10+ */
overflow-y: scroll;
}
body::-webkit-scrollbar {
width: 0px;
background: transparent; /* Disable scrollbar Chrome/Safari/Webkit */
}