0

I have scrollable div

<div id="scrollable" style="overflow-y: auto; height:200px;max-height:800px;width: 80px;">
<div>
<table id="chat_content"></table>
</div>

And JS:

jQuery('#chat_content').append("<tr><td>Hi world</td></tr>");

But when i rich max. height and inserting, it lift me up to top of #scrollable

How to prevent this?

4

1 回答 1

0

尝试这个

$('#chat_content').scrollTop($('#chat_content')[0].scrollHeight);

它会立即滚动到聊天 div 的底部。在 append() 之后运行它。

于 2013-02-27T13:44:10.643 回答