eozzy
eozzy

Reputation: 68650

Dynamic Container Height (jQuery Only)

I have a fixed-height (180px) header and fixed-height footer (50px). I'd like the container height to be: window height MINUS header MINUS footer. If the container height can be updated on window resize, that'd be awesome!

I posted the same question and receive a great answer with a CSS only solution, it works but still have issues in IE6 and 7, so I'd like a jquery Only solution if possible.

Upvotes: 1

Views: 1774

Answers (1)

SLaks
SLaks

Reputation: 887305

You can use the resize event, like this: (untested)

var expandingDiv = $('...');
$(window).resize(function(e) {
    expandingDiv.height(document.documentElement.clientHeight - (180 + 50));
});

Upvotes: 4

Related Questions