If vertical scrollbar is always present css

I have a webpage with infinite scroll. I always want to have a vertical scrollbar, so I added the following style:

html { overflow-y: scroll; } 

This works so that it shows the scroll bar, but it just displays the empty scroll bar, i.e. the cursor does not allow scrolling up or down.

Is it possible to not only display the scroll bar, but also display the cursor?

+4
source share
2 answers

Make the html a little higher and a scroll will appear

 html { overflow-y: scroll; height: 101% } 
+9
source

It's a little hard to say with the limited information you provided. What javascript / plugin do you use to achieve infinite scroll?

My gut instinct is that an infinite scroll can occur in the element below the top level html element. Perhaps try using the browser developer tools to determine which item is actually scrolling, and applying "overflow-y: scrolling"; to that.

Be careful, you may find that the reason they hide the vertical scrollbar is because the plugin you are using makes it meaningless. If the system removes old items from the top of the page to run out of memory, scrolling at the top of the scroll bar may not bring you to the top of the page.

0
source

All Articles