I have a html document in which my chat is running. After receiving a new message i add it with .append. After that i want to scroll down to the bottom of the chat window. but due to some reason nicescroll wont scroll down completly.
my html element:
<div class="chat"> // class chat is unique
<div id="chat_body">
<span id="new_messages">
//messages
</span>
</div>
</div>
the jquery script:
$('#new_messages').append(messagehtml);
$('.chat').getNiceScroll(1).resize();
$('.chat').getNiceScroll(1).doScrollTop($('#chat_body').height() - 1, 1);
nice scroll(1) because there is another nicescroll element on the site.
Using $('.chat').getNiceScroll(1).doScrollTop($('#chat_body').height() - 1, 1);
in the chrome developer console works perfectly fine.
I'm wondering why. Maybe .append
is to slow?