0

据我了解,jQuery 做了一些神奇的测量来确定元素的“正常”高度是多少,以便能够使用.slideDown(). 有没有办法在 jQuery 获得这些测量值后立即获得这些测量值?

具体来说,我想要做的是开始将 html 动画scrollTop到即将显示的目标的底部。

4

1 回答 1

1

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.

于 2012-09-06T21:03:36.170 回答