KingSora / OverlayScrollbars

A javascript scrollbar plugin that hides the native scrollbars, provides custom styleable overlay scrollbars, and preserves the native functionality and feel.
https://kingsora.github.io/OverlayScrollbars
MIT License
3.84k stars 214 forks source link

Scrolling after the first render #554

Closed zapupenec closed 1 year ago

zapupenec commented 1 year ago

Hello! Trying to use your scrollbar in my study project. Faced a scrolling issue after the first render. I was looking at the example https://stackblitz.com/edit/overlayscrollbars-react?file=src%2FApp.tsx The scrollContent function has a condition if (!osInstance) return; to which I cannot scroll. I want to scroll the content to the bottom the first time the application loads. But since osInstance=null, I can't access scrollOffsetElement. I'm just learning and maybe I couldn't figure out how to solve this in react or I missed some overlayscroll parameter. Is there a way to accomplish this? Sorry for my English) I use a translator.