Javascript 在窗口调整大小时调整引导div的大小
这是我上一个问题的延续 我使用的是引导,它不会安排div,使它们具有相同的高度。 我已经解决了将div调整为与children div相同高度的问题 但它不会实时调整大小,即当我调整窗口大小时,“maxHeight”仍然保持不变,尽管在调整窗口大小时该函数仍然运行 下面是函数和代码Javascript 在窗口调整大小时调整引导div的大小,javascript,jquery,twitter-bootstrap,twitter-bootstrap-3,Javascript,Jquery,Twitter Bootstrap,Twitter Bootstrap 3,这是我上一个问题的延续 我使用的是引导,它不会安排div,使它们具有相同的高度。 我已经解决了将div调整为与children div相同高度的问题 但它不会实时调整大小,即当我调整窗口大小时,“maxHeight”仍然保持不变,尽管在调整窗口大小时该函数仍然运行 下面是函数和代码 function resized(){ var maxHeight = -1; if (size == "xs"){ $('.col-xs-12'
function resized(){
var maxHeight = -1;
if (size == "xs"){
$('.col-xs-12').each(function(){
$(this).height("auto");
maxHeight = 0;
});
}
if (size == "sm"){
$('.col-sm-6').each(function() {
maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height();
});
$('.col-sm-6').each(function() {
$(this).height(maxHeight);
});
}
if (size == "md"){
$('.col-md-4').each(function() {
maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height();
});
$('.col-md-4').each(function() {
$(this).height(maxHeight);
});
}
console.log("maxHeight : " + maxHeight);
};
$().ready(function(){
$(document).ready(resized)
$(window).resize(resized);
})
提前谢谢