0
當我通過切換功能(或隱藏/顯示)隱藏某些div時,我想自動調整我的2列(sameht)的高度。在隱藏/顯示div上自動調整列高度(第2部分)
<div class="span2 sameht">
<div class="content">
<div class="hidelevel">something</div>
<div>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>
<!-- how it should be sameht after hide divs-->
<div class="span2 sameht2">
<div class="content">
<div>something</div>
<div>something</div>
<div>something</div>
</div>
</div>
<div class="span3 sameht2">
<div class="content">
<div>something</div>
<div>something</div>
</div>
</div>
<!-- toggle -->
<div id="toggle">Toogle Visibility sameht</div>
有對我用這個代碼
$(function() {
adjustHeight();
$("#toggle").click(function(){
$(".hidelevel").toggle();
adjustHeight();
});
});
function adjustHeight(){
var maxHeight = 0
$('.sameht').each(function() {
if ($(this).height() > maxHeight) {
maxHeight = $(this).height();
}
});
$('.sameht').height(maxHeight);
}
var maxHeight = 0
$('.sameht2').each(function() {
if ($(this).height() > maxHeight) {
maxHeight = $(this).height();
}
});
$('.sameht2').height(maxHeight);
當我隱藏的div(.hidelevel)列在同一高度,並呼籲adjustHeight功能「sameht」列不調整的高度列(請參閱sameht2應該如何)。
你有什麼想法我該怎麼做?謝謝。
對不起,但這不是我的問題! sameht2是正確的結果方面,我不想改變它!我想你不明白我的問題。 –