Alexander
Alexander

Reputation: 155

Error with nicescroll scrolling down

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?

Upvotes: 0

Views: 1486

Answers (2)

Suman Kumar
Suman Kumar

Reputation: 27

make a change in the plugins, replace the following

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

with

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

Upvotes: 0

Master Jowin
Master Jowin

Reputation: 11

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

Upvotes: 0

Related Questions