我有一個包含兩列的html頁面。在隱藏/顯示div上調整列高度
<div class="span2 sameht">
<div class="content">
<div class="hidelevel">something</div>
<div class="hidelevel">something</div>
<div>something</div>
<div>something</div>
</div>
</div>
<div class="span3 sameht">
<div class="content">
<div>something</div>
<div>something</div>
</div>
</div>
有對列相同的高度我用這個代碼
$(function() {
var maxHeight = 0
$('.sameht').each(function() {
if ($(this).height() > maxHeight) {
maxHeight = $(this).height();
}
});
$('.sameht').height(maxHeight);
});
現在,當我躲在這樣的列高度不動態調整股利(.hidelevel
類)。
$(function() {
$(".hidelevel").hide();
})
難道我每次隱藏/顯示<div>
的時間來重新大小的柱的高度?
感謝
可以請你建立一個工作撥弄你的代碼? – BeNdErR
把你的兩個div放在父div中。當你隱藏/顯示最高的那個時,父div會自動調整,而不是jquery trick – TCHdvlp
你有一個叫做span的div。這不能很好地結束。 –