Simple Scrolling down in jQuery
Well tried getting jQuery ScrollTo plugin to work, and I couldn't. Anyways that looks like a pile of mess and in my case I don't want to scroll anywhere other than bottom of an element.
Eric's blog mentions a very clean way to do it -
var objDiv = document.getElementById("divExample");
objDiv.scrollTop = objDiv.scrollHeight;
and what I am doing is precisely the same but by using jQuery animate -
The good this about this one is, that it actually scrolls down smoothly :)
Looks great if you are popping out small divs at bottom of a container as in my case -
One noticeable point is that, always keep .animate()'s time period greater than .show()'s, otherwise it won't scroll completely to the base and the new element hasn't grown yet.
This is the chatbox div where I am populating messages with auto scrolling :) -