如何保持滚动条底部的div? [英] How keep scroll bar in bottom in div?
问题描述
我有很多的标签,当单击任一选项卡,将显示一个垂直滚动股利。像Facebook的消息页面:点击时接受任何用户名。对话似乎和滚动条在DIV的默认底部
I have many tabs and when click any tab, a vertical scrolling div is shown. Like facebook messages page: When click to any User's name. Dialog seems and scroll bar is on the bottom of div by default.
下面是标签:
<ul class="companies">
@foreach (var item in Model)
{
<li id='company_@(item.Id)' data-id='@item.Id' >
<a>@item.Name</a>
</li>
}
</ul>
和内容:
@foreach (var item in Model)
{
<div id="scrollingDiv" class="scrollingDiv"> @item.News </div>
}
和CSS:
.scrollingDiv {
overflow-x: hidden;
max-height: 500px;
overflow-y: scroll;
}
我想保持滚动条上的底部时,单击任一选项卡。 (要查看总是在最后的新闻)。目前还DIV。我检查这个的问题。但是,在我的应用程序没有奏效。我怎样才能解决这个问题呢?
I want to keep scroll bar on the bottom when click any tab. (To see always last news). Also current div. I checked this questions. But not worked in my application. How can I solve this issue?
推荐答案
jQuery的 scrollTop的()
功能可能正是你需要的。请参见 http://api.jquery.com/scrollTop/
jQuery's scrollTop()
function might be just what you need. See http://api.jquery.com/scrollTop/
这篇关于如何保持滚动条底部的div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!