我有一個項目列表,根據標準,它通過document.ready上的jQuery獲得一個類,觸發CSS3列。重新計算jQuery在元素更改後的元素高度
如果列表以列顯示,它將具有較小的高度。有沒有什麼方法可以在課堂更改後立即在jQuery中獲得新的高度?
$items.each(function(i){
var theItem = this;
console.log($(theItem).height());
//extended layout
if (theCriteria) {
$(theItem).addClass('extended');
console.log('after', $(theItem).height()); }
}
上面的代碼返回兩個調用的初始高度。我猜我需要觸發別的東西。
難道你不能只檢查改變類的代碼的高度? – 2010-01-04 07:04:19
不行,它不起作用。我會在一秒內發佈代碼 – GreenDude 2010-01-04 07:08:33