E
E
eugenedrvnk2021-01-29 15:11:44
JavaScript
eugenedrvnk, 2021-01-29 15:11:44

How to avoid jump scrolling when adding new items to the list?

I am developing a chat and need to implement the loading of old messages. When the user has scrolled to the top of the page, I request a new message block and insert it at the top of the list, then calculate how much space this new block has taken up and scroll down by that value. And during this process, you can notice a short jump in the list. How can this be avoided?

demo is here

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2021-01-29
@HistoryART

Fix the maximum value of the scroll with the current filled place, then add content and update the value, if you don't twist, there will be no jump.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question