Technologies Ignited

Technologies Ignited

Scrolling an element to its bottom using jQuery

leave a comment »

Here’s a very nice example of scrolling a certain div to its bottom.
You might need such a thing, for example, if you are developing an ajax chat.
You must have the jQuery library loaded and in our case the div has id chatHolder.

	//Append the new content goes here
	//Getting the element's new height now
	var sHeight = $('#chatHolder')[0].scrollHeight;
	//Scrolling the element to the sHeight
	$('#chatHolder').scrollTop(sHeight);

Written by wyand

23 April 2012 at 11:41

Posted in Other

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: