Solution 1 :

I found this answer useful, I just created the same logic but in React
jquery – keep window from changing scroll position while prepending items to a list?

Problem :

I want when the user scrolls from the bottom to the top of a div to load more items into that div to the top part of the div and I want to maintain the scroll position (or rather make sure the top item before adding more items is still visible after adding the items)

For example if I have item 100 on the top and 100 more items has been loaded into the div then I want item 100 to still be the focus of the scroll position, currently when I add items to the div it jumps to item 200…

I’d love to get help with this issue, thanks in advance 🙂

Comments

Comment posted by Uthistran Selvaraj

get scroll offset before adding 100 items and set to it again after adding.. this is one way of logic. try to have simple sample and we can help to achive yours

By