Skip to content

How do I get scrollbar.scrollTo to work on dynamic content? #536

Answered by sadeghbarati
JulianParge asked this question in FAQ
Discussion options

You must be logged in to vote

Hi,

smooth-scrollbar automatically updates itself with ResizeObserver after you append new element to the document

You can use addMomentum

append is synchronous so you can get size of the appended element after You append element

$('#chat_window .scroll-content').append('<div class="chat-local-wrap"><div class="chat-local chats">'+chatData+'</div></div>');
scrollbar.addMomentum(0, size of appnded element)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@JulianParge
Comment options

Answer selected by JulianParge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
FAQ
Labels
None yet
2 participants