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:
On modern browsers you can use wheel event:
// Content is the element you want to apply the wheel scroll effect to
content.addEventListener('wheel', function(e) {
const step = 100; // How many pixels to scroll
if (e.deltaY > 0) // Scroll down
content.scrollTop += step;
else // Scroll up
content.scrollTop -= step;
});
I happen to try the above solutions in my project and for some reason I was not able to hide the scroll bar due to div positioning. Hence, I decided to hide the scroll bar by introducing a div that covers it superficially. Example below is for a horizontal scroll bar:
<div id="container">
<div id="content">
My content that could overflow horizontally
</div>
<div id="scroll-cover">
</div>
</div>
Corresponding CSS is as follows:
#container{
width: 100%;
height: 100%;
overflow: hidden;
position: relative;
}
#content{
width: 100%;
height: 100%;
overflow-x: scroll;
}
#scroll-cover{
width: 100%;
height: 20px;
position: absolute;
bottom: 0;
background-color: #fff; /*change this to match color of page*/
}
You can use the code below to hide the scroll bar, but while still being able to scroll:
.element::-webkit-scrollbar {
width: 0 !important
}
Just use following three lines and your problem will be solved:
#liaddshapes::-webkit-scrollbar {
width: 0 !important;
}
Where liaddshapes is the name of the div where scroll is coming.
To hide scroll bars for elements with overflowing content use.
.div{
scrollbar-width: none; /* The most elegant way for Firefox */
}
I just wanted to share a combined snippet for hiding the scrollbar that I use when developing. It is a collection of several snippets found on the Internet that works for me:
.container {
overflow-x: scroll; /* For horiz. scroll, otherwise overflow-y: scroll; */
-ms-overflow-style: none;
overflow: -moz-scrollbars-none;
scrollbar-width: none;
}
.container::-webkit-scrollbar {
display: none; /* Safari and Chrome */
}