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: none;
}
But Mozilla Firefox and Internet Explorer don't seem to work like that.
I also tried this in CSS:
overflow: hidden;
That does hide the scrollbar, but I can't scroll anymore.
Is there any way I can remove the scrollbar while still being able to scroll the whole page? With just CSS or HTML, please.
Call these functions, for any point you want to load or unload or reload the scrollbars. Still scrollable in Chrome as I tested it in Chrome. Not sure of the other browsers.
this will be at the body:
and that is the css:
As of December 11th 2018 (Firefox 64 and above), the answer to this question is very simple indeed as Firefox 64+ now implements the CSS Scrollbar Styling spec.
Just use the following CSS:
Firefox 64 release note link here.
Just set the width of the child's width to 100% , padding to 15px, overflow-x to scroll and overflow:hidden for the parent and whatever width you want, it works perfectly on all major browsers including IE Edge with an exception of IE8 and lower.
Just a test which is working fine.
Working Fiddle
JavaScript:
Since, the scrollbar width differs in different browsers, it is better to handle it with JavaScript. If you do
Element.offsetWidth - Element.clientWidth
, the exact scrollbar width will show up.JavaScript Working Fiddle
or
Using
Position: absolute
,Working Fiddle
JavaScript Working Fiddle
Info:
Based on this answer, I created a simple scroll plugin. I hope this will help someone.
I had this problem. Super simple to fix. get two containers. The inner will be your scrollable container and the outer will obviously house the inner:
Super simple and should work with any browser. Good Luck!