I have a list that is styled as dropdown menu.
I want the scrollbar to show so that user will know it is scrollable. Scrollbar only shows when you scroll. I want it to show on default.
NOTE: This works on desktop but not on a mobile device.
Here are screenshots:
Scroll bar doesnt show on default
Scroll bar shows only when scrolling
Here is my code:
Ok, so - at first - I thought it was being hidden by the parent element. But it wasn't. That's not the case on mobile devices (but a great method to hide it altogether on a long hamburger sidebar that shows content being cut off in landscape but still needs to scroll without wasting valuable space.)
In this case, you are actually hiding the scrollbar, in theory:
-webkit-appearance: none;
However, when you add the following code afterwards to control the style of your scrollbar, it will immediately bring it back to the party - making it like half my friends... starving for attention.
::-webkit-scrollbar {
-webkit-appearance: none;
}
::-webkit-scrollbar:vertical {
width: 10px;
}
::-webkit-scrollbar:horizontal {
height: 10px;
}
::-webkit-scrollbar-thumb {
background-color: #ccc;
border-radius: 10px;
border: 2px solid #eee;
}
::-webkit-scrollbar-track {
background-color: #eee;
}