Calculate a div's height with jQuery - minus header and footer

Posted by Dirty Bird Design on Stack Overflow See other posts from Stack Overflow or by Dirty Bird Design
Published on 2012-10-09T01:47:51Z Indexed on 2012/10/09 3:37 UTC
Read the original article Hit count: 161

Filed under:

I'm using a sticky footer (negative margin solution) and it works fine. What I need to do is calculate the window's height, subtract the known height of the header and footer then apply that number and use it for the height of the main wrapper div. CSS solutions cause other issues, is there a good way to do this?

var h = window.height();
var k = 300; //header is 100px footer is 200px
$('#wrap').height(h-k);

rough idea, pls help.

© Stack Overflow or respective owner

Related posts about jQuery