Infinite scrolling


I’m building a chat app, and I would like to add infinite scrolling so that when a user scrolls up, more messages are loaded. I applied some stuff from here: I have a scrollable div, but when a new message is loaded, the scroll position is messed up. How can I maintain scroll position with infinite scrolling? If code examples are wanted, please let me know.


Yes, code samples are welcome and will help us troubleshoot.

Can you explain this a bit further - do you mean when new messages load your window scroll position jumps around, or something else?


Sorry for not responding earlier, the issue was that the limit parameter in the query was static, so messages from the top were getting removed from the DOM and that was messing up the scroll. Thanks for your response!