Closed hirohope closed 10 years ago
When a new element is added to the collection, the viewport gets longer but browsers will keep the scroll position where it is (measured from the top). So to get auto-scroll, you have to adjust scrollTop to keep it pinned. The sticky flag is set whenever the user scrolls to the bottom so it's not always on.
But when I add elements, wouldn't I want to keep the scroll position in the former last element and not go to the new last one? Why did you want this behaviour?
Auto-scrolling is useful for log views. Anywhere you want to see the latest realtime data. It never occurred to me that people might want to turn it off! I guess an "autoscroll" attribute would make sense.
Oh you're right. In the project I'm working the new data goes on top of the list and not bottom. Thanks for your answers.
I've been reading the code to understand how it was made, but I can't figure out why is necessary to modify the scrollTop if the scroll it's already there.
This is in 61b0cdc