【发布时间】:2012-04-04 03:29:00
【问题描述】:
为什么当对象的 parent 设置为 display: none 时,我无法获取对象的 min-height,但如果 min-height 为 ,我仍然可以获取对象的高度没有在使用中?
例如,
CSS,
li {
display:none;
}
.object {
display:block;
width:100px;
border:1px solid #000;
}
html,
<li><a href="#" class="object" style="height:200px;"><img class="element" /></a></li>
<li><a href="#" class="object" style="min-height:300px;"><img class="element" /></a></li>
jquery,
$(document).ready(function(){
$('.object img').each(function(){
alert($(this).parent().height());
});
});
即使其父对象设置为display none,我如何仍能获得对象的min-height?
【问题讨论】: