元素隐藏时 jQuery.outerHeight 不起作用?
我试图找出元素的外部高度(包括填充),但它似乎不起作用。
我总是得到0。是因为该元素被隐藏了吗?
该元素包含在具有“自动”高度的绝对定位元素内,但我认为这不应该是一个问题,因为该元素是相对的......
I'm trying to find out the outer height of a element (including padding) and it doesn't seem to work.
I always get 0. Is it because the element is hidden?
The element is contained inside a absolute-positioned element with "auto" height, but I don't think that should be a issue, because the element is relative...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
隐藏元素具有外部高度,
请添加您的 html 代码以获得更完整的答案
a hidden element has an outer height,
please add your html code for a more complete answer
具有
display: none;
的隐藏元素不会注册高度或宽度,但具有visibility: hide;
的元素会注册高度或宽度,但它还必须附加到 < code>body 或其子元素之一。An element with hidden with a
display: none;
does not register height or width, but an element withvisibility: hidden;
does, but it also must be attached to thebody
or one of its children elements.