make jquery use min-height not just height
The code:
function setEqualHeight(columns) {
var tallestcolumn = 0;
columns.each(function(){
currentHeight = $(this).height();
if(currentHeight > tal开发者_如何学Clestcolumn){
tallestcolumn = currentHeight;
}
});
if (tallestcolumn <= 1000) {
columns.height(tallestcolumn + 4);
}
}
$(document).ready(function() {
setEqualHeight($("#main-content-bottom-bg > div"));
});
I know its probably simple, but I just cannot figure out what I give. I would think something like this:
columns.minheight(tallestcolumn + 4);
Thanks.
use this function :
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"));
});
Almost... try:
columns.css('min-height', (tallestcolumn + 4) + 'px');
Similar to: jQuery - Set min-height of div
Try this instead :
columns.css('min-height',(tallestcolumn + 4)+'px');
精彩评论