0
我有一个div
其中包含一个聊天框。每当有新消息到达时,它都会被附加到框中 - 我想自动将框移动到底部(以显示新消息)。我怎样才能做到这一点?自动滚动div
<div id="chatting" style="overflow: auto; background-color: #fff; border: solid 2px #dedede; width: 600px; height: 500px; padding: 10px;">
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
hello<br/>
</div>
[如何在添加数据时自动滚动到div末尾?](http://stackoverflow.com/questions/7303948/how-to-auto-scroll-to-end-of-div -when-data-is-added) –
我不确定我是否理解这个问题。你想让页面在加载时滚动到底部吗? –