0

Is there a way to add div containers into perfect-scrollbar (https://www.npmjs.com/package/perfect-scrollbar) once loaded without shifting the current location. Similar to how Android does their recycler-view.

IE if i have a scrollable DIV with elements from 10 - 100 and im at scroll position 30 and i add elements from 0 - 10 to the top (so total list would be 0 - 100) i notice when i do that while on 30 it reshift everything to point 0. Is there a way to add elements without reshifting everything?

Or is there another package i could use for the web to act similar to recycler-view?
Thanks.

civic.sir
  • 400
  • 1
  • 9
  • 26
  • Do you have a working example for us. There are a few options possible, but actual code is easier. – Mouser Jan 11 '20 at 22:09
  • Here is a sample code: https://codesandbox.io/s/ps-bottom-padding-issue-6hzq9?fontsize=14&hidenavigation=1&theme=dark I want the page to load up with initial scroll position at 200px - which has the scrollview pointing at the word "DOWN" as the first element, and user has the ability to scroll up or down – civic.sir Jan 13 '20 at 21:38

1 Answers1

0

I have found the solution. Thank you for everyone looking into this. Solution was to :

setTimeout(() => {$('#select__ps').scrollTop = 200}, 0);
civic.sir
  • 400
  • 1
  • 9
  • 26