如何在< div>中显示最新的附加文本有滚动条的标签? [英] How to display the latest append text in <div> tag which is having scrollbar ?

查看:88
本文介绍了如何在< div>中显示最新的附加文本有滚动条的标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有一个带有讨论ID的div标签。所以基本上div标签的功能是在两个人之间进行讨论。我的div标签工作正常,但它没有什么改进我正在寻找

我有一个带滚动条自动的div标签。

I have a div tag in my website which has id "discussion". So basically the function of div tag is to have a discussion between two people. My div tag is working fine, but there is little improvement in it i am looking for
I have a div tag with scroll bar auto.





因此当附加文本超过div标签的长度时,自动生成滚动条以向下滚动内容,但在这里我想要我的srollbar始终保持下行,以便div标签中的最新内容应该是可见的,而在当前场景中,我必须一次又一次地滚动滚动条以查看div标签中的最新内容。



任何帮助都会被提前感谢!


So when the append text exceeds the length of div tag scrollbar is auto generated to scroll down the content, but here i want my srollbar to always remain downside so that latest content in the div tag should be visible, whereas in the current scenario i have to again and again scrolldown the scrollbar to view the latest content in div tag.

Any help would be appreciated, thanx in advance!

推荐答案

使用此代码我可以完成维护垂直滚动条的任务自动在底部,这样可以在不滚动的情况下查看新的附加文本。

With this code i could achieve the task of maintaining vertical scrollbar automatically at bottom so new appended text could be viewed without scrolling.
window.onload=scrollPanel();
     function scrollPanel()
     {


#chats)。animate({
scrollTop:
("#chats").animate({ scrollTop:


#chats)[ 0 ]。scrollHeight
},' slow');

}
("#chats")[0].scrollHeight },'slow'); }


这篇关于如何在< div>中显示最新的附加文本有滚动条的标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆