sveltejs / svelte-virtual-list

A virtual list component for Svelte apps
https://svelte.dev/repl/f78ddd84a1a540a9a40512df39ef751b
Other
689 stars 58 forks source link

Feature request: Initial "start" value (auto-scroll to certain element) #28

Open Kreozot opened 5 years ago

Kreozot commented 5 years ago

I really need to auto-scroll the list to remembered position. But the algorythm is kinda complicated. So I failed to do it myself so far. Maybe somebody can give me a hint how to achieve this behaviour. Or even make it if it is not so complicated.

I did almost all needed changes (as I think :)), but part after "prevent jumping if we scrolled up into unknown territory" is ruin everything, since I don't know previous row heights.

Thank you!

Diff by my code so far: https://github.com/sveltejs/svelte-virtual-list/compare/master...Kreozot:initial-position?expand=1

Kreozot commented 5 years ago

Also I think, I made some mistake. Because scroll is jumping even if I scroll down after initial render.