我有元素有雜項高度。根據第一個塊,我需要爲其他元素添加一些margin-top。我被用於jQuery高度屬性的這個動作,但它不起作用。你可以幫我嗎?使用jQuery添加基於其他元素高度的頂部邊距
這是我的代碼:
$(document).ready(function(){
if ($('.post_discussion_header').height(79) + 'px'){
$('.no_0').css('margin-top','110px');
}
});
});
TIA。
您的if語句錯了,您想要驗證的是什麼? – 2011-12-15 08:32:17