在这种情况下,具有ID“ target”的元素具有通过CSS设置为“无”的元素。但是,当使用$(“#target”)检查其高度时。 If an element has an offsetWidth of 0 (considered "hidden" by jQuery), the library attempts to determine its height.
To accomplish this, jQuery temporarily applies the following properties to the element:
position: "absolute"visibility: "hidden"display:然后,使用getWidThorheight(...)检索“ block”此机制使.height()/。width()甚至在隐藏的元素上起作用,前提是他们的父元素可见。因此,您可以调用.height()/。width(),而无需手动执行节目/隐藏序列,因为这些方法是通过这些方法内部处理的。
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3