javascript - Scroll to bottom on page load -


I have the following code, this is a chat display that was using the Firebase API. The problem is that when the page loads, I want to set it straight to the scrollbar on the bottom. At the moment it is slowly sliding down (because basically). When I reload the page, how can I always scroll down the bar, even if new content is added to the chat?

  $ (document) .ready (function () {var myDataRef = new Firebase ('https://ot7fwnsj7h7.firebaseio-demo.com/'); myDataRef.on ('child_added' , Function (snapshot) {var message = snapshot.val (); display message (message.name, message.text);}); function displaylames (name, text) {$ ('& lt; div / & gt;' ). Text (name + ':')). AppendTo ($ ('# displayChat')); // Every time someone posts a text ($ '(' <'/' '' #displayChat '). Chetan ({scrollTop: $ ("# displayChat") [0] .scrollHeight},' Slow ');};});  

And this is my favorite:

I hope that I have become clear! Thank you.

This line of code scrolls the element at its bottom, every time you update the update, Then call him.

  $ ("# displayChat") [0] .scrollTop = $ ("# displayChat") [0] Scroll Height  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -