A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearAJAX chat, auto scroll window - page 1
User InfoPosts
AJAX chat, auto scroll window#1

Scrolling Overflowed DIVs with JavaScript

I have an AJAX chat that outputs the messages to a div with overflow: auto so if it gets too long, the scroll bar comes up. Is there is a way to have it auto scroll to the bottom whenever a new message is added? Preferably using jQuery?

posted date: 2009-04-11 17:25:00

Re: AJAX chat, auto scroll window#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-11 17:25:01

Re: AJAX chat, auto scroll window#3
@Brandon: this question has already been asked and answered; i've added a link to the existing discussion at the top of yours.

posted date: 2009-04-11 17:29:00

Re: AJAX chat, auto scroll window#4
it(d be done with the following line$("#youChatDiv").attr({ scrollTop: $("#youChatDiv").attr("scrollHeight") });what this does is set the scroll to the height of the own elementjust call that with every new message :)cheers

posted date: 2009-04-11 22:23:00

Re: AJAX chat, auto scroll window#5
Property scrollHeight is the ideal but it is not part of the W3C. For further understanding visit:http://yelotofu.com/2008/10/jquery-how-to-tell-if-youre-scroll-to-bottom/

posted date: 2009-04-11 23:55:00

Re: AJAX chat, auto scroll window#6
If each message is in a separate element (div, paragraph etc.), you can just call scrollIntoView

posted date: 2009-04-12 08:11:00

Re: AJAX chat, auto scroll window#7
This Jquery plugin will help you. Jquery ScrollTo plugin demo page

posted date: 2009-07-02 00:39:00

Re: AJAX chat, auto scroll window#8
The scrollTop and scrollHeight attributes are now properties, so you should use prop instead of attr.

posted date: 2011-11-05 15:55:00

select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.