1
我正在使用下面的代碼來等於列高度,但它沒有在其中計算填充,所以文本走出div。等高欄不添加填充
<script>
$(document).ready(function(){
//set the starting bigestHeight variable
var biggestHeight = 0;
//check each of them
$('.equal').each(function(){
//if the height of the current element is
//bigger then the current biggestHeight value
if($(this).height() > biggestHeight){
//update the biggestHeight with the
//height of the current elements
biggestHeight = $(this).height();
}
});
//when checking for biggestHeight is done set that
//height to all the elements
$('.equal').height(biggestHeight);
});
</script>
已經被加載,我相信你的原則是有前途的,但不容易理解爲像我這樣的初學者。所以這是我的要求,如果你可以給我一些例子與我的代碼。 – 2012-08-10 11:49:20
@pixelngrain可能只是你需要等待圖像加載。看看我編輯的答案 – 2012-08-10 12:00:17
它像我的代碼一樣。不考慮填充。任何想法? – 2012-08-10 12:08:45