开发者

Dynamic Container Height (jQuery Only)

开发者 https://www.devze.com 2022-12-14 03:35 出处:网络
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 res

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 t开发者_开发问答he 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.


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

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

精彩评论

暂无评论...
验证码 换一张
取 消