小编tar*_*rek的帖子

自动滚动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>
Run Code Online (Sandbox Code Playgroud)

html css jquery

0
推荐指数
1
解决办法
781
查看次数

标签 统计

css ×1

html ×1

jquery ×1