2011-08-05 110 views
0

代码:化妆使用jQuery的最小高度不只是高度

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); 

谢谢。

+0

和你的问题是? –

+0

他想改变一些元素的“最小高度”。我认为这很清楚。 – karim79

回答

1

使用此功能:

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")); 
}); 
+0

谢谢。既然你最早我会给你胜利。再次感谢! – oneadvent

0

试试这个:

columns.css('min-height',(tallestcolumn + 4)+'px'); 
+0

真棒谢谢。我知道这会很容易,但我的大脑只是被炸。再次感谢! – oneadvent