Auto resize, resize only when window is getting bigger

Author: | Posted in Test No comments

Take a look at the documentation of height(). It can return and set the height, which means you don’t need the css approach.

Here is a small example:

<div id="header"><h1>My Header</h1></div>
<div id="content" style="border: 1px solid black;">My dynamic content</div>
<div id="footer">My footer</div>

<script type="text/javascript">
$(window).resize(function() {
var freeSpace = $(window).height() - ($("#header").height() + $("#footer").height());


Add Your Comment