jQuery 调整高度


jQuery.fn.ExpandHeight = function(containId){
    var divheight;
    divheight = $(window).height() - $("#" + containId).position().top -15;
    $("#" + containId).height(divheight);

}

上面的是jquery插件, 可以使div正好达到窗口可容纳的最大高度;

调用: jQuery.fn.ExpandHeight ("divId");

左边的div下沿正好与右边的表格行的下沿相平:

var h = $("#trFlag").position().top + $("#trFlag").height() - $("#divList").position().top;
$("#divList").height(h);

相关内容