据我了解,jQuery 做了一些神奇的测量来确定元素的“正常”高度是多少,以便能够使用.slideDown()
. 有没有办法在 jQuery 获得这些测量值后立即获得这些测量值?
具体来说,我想要做的是开始将 html 动画scrollTop
到即将显示的目标的底部。
If I'm understanding your question correctly, jquery's height
already handles this "magic". Native offsetHeight
will return 0 for hidden elements but jquery's height
will return their proper height.
Also, if you're curious about the magic. They basically set the { position: "absolute", visibility: "hidden", display: "block" }
on the element, check the height, then revert back to the original values.