有没有办法返回已设置为auto的元素的高度?当我调用$(“#element”)时,我得到0。高度();
这是jquery代码。 img.height()返回0因此最终结果关闭。
img.css({top: (img.parent().height() - img.height()) /2, left: (img.parent().outerWidth() - img.outerWidth()) / 2});
HTML看起来像这样:
<div id="exploreImage" class="virtual-room-large" style="width: 288px; height: auto; top: 185px; left: 89px; ">