0

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?

Seth
  • 10,198
  • 10
  • 45
  • 68
Alexander
  • 155
  • 13

2 Answers2

0

I face the same problem. The only way I overcome it, is by adding one <br/> at the last of the content.

0

make a change in the plugins, replace the following

(q=!1,e.stopImmediatePropagation(),e.preventDefault())

with

(q=!1,e.stopImmediatePropagation())
Suman Kumar
  • 27
  • 1
  • 1
  • 7