JQuery: dynamic height() with window resize()

前端 未结 4 1664
再見小時候
再見小時候 2021-01-31 05:00

I\'m having an issue identical to this poster: Jquery problem with height() and resize()

But the solution doesn\'t fix my issue. I have three stacked divs, and I want to

4条回答
  •  太阳男子
    2021-01-31 05:09

    I feel like there should be a no javascript solution, but how is this?

    http://jsfiddle.net/NfmX3/2/

    $(window).resize(function() {
        $('#content').height($(window).height() - 46);
    });
    
    $(window).trigger('resize');
    

提交回复
热议问题