如何获取溢出的真实.height():隐藏或溢出:滚动div? [英] How do I get the real .height() of a overflow: hidden or overflow: scroll div?

查看:206
本文介绍了如何获取溢出的真实.height():隐藏或溢出:滚动div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于如何获得div高度的问题.我知道.height()innerHeight(),但是在这种情况下它们都不适合我.事实是,在这种情况下,我有一个div溢出宽度为div:滚动且div具有固定高度.

I have a question regarding how to get a div height. I'm aware of .height() and innerHeight(), but none of them does the job for me in this case. The thing is that in this case I have a div that is overflown width a overflow: scroll and the div has a fixed height.

如果我使用.height()innerHeight(),它们都给了我可见区域的高度,但是如果我想考虑溢出的部分,该怎么办?

If I use .height() or innerHeight(), both of them gives me the height of the visible area, but if I want the overflown taken in to account, how do I go about?

推荐答案

使用 .scrollHeight 属性:$('#your_div')[0].scrollHeight

这篇关于如何获取溢出的真实.height():隐藏或溢出:滚动div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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