Html auto scroll to bottom

I have actually made chat device, but I had actually a difficulty with scrolling div for the messperiods that the scroll bar need to be at the bottom as default.

You watching: Html auto scroll to bottom



.chat-scrollposition: absolute; top:0px; bottom: 0px; overflow-y: auto;I use JQuery for submit message from the input create to reload the content of the #chat-scrolland the auto scrolling is okay for submit, but once at initially load of the page, the scroll just stays at the middle of the div #chat-scroll. Unprefer if I submit a message it will certainly go to the bottom once I sfinish message.

See more: Front Face For Public Displays Alternatives & Competitors, Mirabyte Frontface For Public Displays Review

JQuery For Scrolling

$("#chat-scroll").animate(scrollTop: $("#chat-scroll").get(0).scrollHeight, 2000);



When window pack scroll your chat div at bottom utilizing document.ready


$(document).ready(function() $("#chat-scroll").animate( scrollTop: $("#chat-scroll").get(0).scrollHeight , 2000););



Thanks for contributing a solution to Stack Overflow!

Please be sure to answer the question. Provide details and also share your research!

But avoid

Asking for aid, clarification, or responding to other answers.Making statements based upon opinion; back them up with referrals or personal suffer.

See more: How To Unblock Someone On Tumblr App, Blocking Users

To learn even more, check out our tips on writing good answers.

Blog post Your Answer Discard

By clicking “Post Your Answer”, you agree to our regards to business, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged jquery css or ask your very own question.


site design / logo © 2021 Stack Exreadjust Inc; user contributions licensed under cc by-sa. rev2021.4.1.38970

Your privacy

By clicking “Accept all cookies”, you agree Stack Exadjust can store cookies on your gadget and discshed indevelopment in accordance with our Cookie Policy.