jQuery代码段, 根据窗口的大小设置页面内容区域的最小高度 。 这可以用来将页面的页脚设置为始终位于页面内容区域的底部,而不管窗口的大小如何。 它可以与捕获窗口调整大小一起使用,以便在用户调整浏览器窗口大小时自动调整大小。
//sets the minimum height for the content area of the page
minWrapperHeight: function()
{
var wrapperElem = $('#wrapper');
//padding+offset+header+footer
var offset = wrapperElem.height()-wrapperElem.outerHeight()-$('header').height()-$('footer').height()-$('#wrapper').offset()['top'];
console.log($(window).height() + ' - ' + offset + ' = ' + ($(document).height()-offset));
wrapperElem.height($(window).height()+offset); //offset is negative
}
From: https://www.sitepoint.com/jquery-set-minimum-height-page-content/