通过溢出获取div的高度:自动; [英] get height for a div with overflow:auto;

查看:405
本文介绍了通过溢出获取div的高度:自动;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个高度为100px的div,溢出为:auto 内容是动态的.

i have a div with height:100px and overflow:auto the content is dynamic.

我要在底部滚动div

i want scroll the div in the bottom

我尝试过

$("#chat_content").scrollTop($("#chat_content").height());

,但如果内容大于100px $(#chat_content").height()返回100,并且div不在底部滚动

but if the content is bigger than 100px $("#chat_content").height() returns 100 and the div isn't scrolled on the bottom

我该怎么办?

谢谢

推荐答案

获取 属性:

$("#chat_content").scrollTop($("#chat_content").get(0).scrollHeight);

这篇关于通过溢出获取div的高度:自动;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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