Resize div on browser resize

后端 未结 2 972
广开言路
广开言路 2021-01-07 02:59

I have a

which I want to display full screen, but I also need to incorporate a 60px high
and a 10px
2条回答
  •  情话喂你
    2021-01-07 03:17

    Try this:

    $(window).resize(function(){
      $('#fullscreen').height($(document).height() - ($('#div1').height() + $('#div2').height()) + 'px');
    });
    

    Updated Based On Comment:

    I am using the jQuery in above code, you will have to download and include it in your page first.

    Once you have downloaded and included in your page, then use this code:

    $(function(){
        $(window).resize(function(){
          $('#fullscreen').height($(document).height() - ($('#div1').height() + $('#div2').height()) + 'px');
        });
    });
    

提交回复
热议问题