Reputation: 3681
I have a div and it has a scroll bar here is the code I've used:
<div style="width: 200px; height: 250px; overflow: scroll; overflow-x: hidden; -ms-overflow-x: hidden;" id="container"></div>
There will be more text added to the div but when the div does expand how can I have the vertical scroll bar remain at the bottom of the bar so the user can see the appended text?
Upvotes: 0
Views: 2225
Reputation: 154898
You should set the scrollTop
to scrollHeight
, e.g.: http://jsfiddle.net/fAK2L/1/.
var div = $('div');
div.scrollTop( div.get(0).scrollHeight );
Upvotes: 3