代码:
function setEqualHeight(columns) {
var tallestcolumn = 0;
columns.each(function(){
currentHeight = $(this).height();
if(currentHeight > tallestcolumn){
tallestcolumn = currentHeight;
}
});
if (tallestcolumn <= 1000) {
columns.height(tallestcolumn + 4);
}
}
$(document).ready(function() {
setEqualHeight($("#main-content-bottom-bg > div"));
});
我知道这可能很简单,但我就是不知道我给出了什么。我想是这样的:
columns.minheight(tallestcolumn + 4);
谢谢。
最佳答案
使用此功能:
function setEqualHeight(columns){
var tallestcolumn = 0;
columns.each(function(){
currentHeight = $(this).height();
if(currentHeight > tallestcolumn){
tallestcolumn = currentHeight;
}
});
if (tallestcolumn <= 1000) {
columns.css("min-height",(tallestcolumn + 4)+"px");
}
}
$(document).ready(function() {
setEqualHeight($("#main-content-bottom-bg > div"));
});
关于javascript - 让jquery使用min-height而不仅仅是高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6950255/