我有以下构建我的HTML文档中:匹配的元素高度的jQuery/HTML
<div class="content">
<section class="column"></section>
<aside class="column"></aside>
</div>
我想匹配部分的高度和一边的最高两者的高度。我有以下的脚本,但它不工作,任何想法:
function unifyHeights()
{
var maxHeight = 0;
$('div.content').children('.column').each(function(){
var height = $(this).outerHeight();
if (height > maxHeight) { maxHeight = height; }
});
$('.column').css('height', maxHeight);
}
你测试,如果匿名函数被调用了两次,用正确的孩子吗?你看过“高度”的值是否被赋值? 'maxHeight'增加了吗? – 2010-11-11 22:48:08