How to change height div on window resize?

后端 未结 6 2085
醉话见心
醉话见心 2020-11-30 01:15

I have a div on my website that should be the height of the window. This is what i got:

    $(document).ready(function() {
    var bodyheight = $(document).h         


        
6条回答
  •  佛祖请我去吃肉
    2020-11-30 01:41

    Use the resize event.

    This should work:

     $(document).ready(function() {
       $(window).resize(function() {
        var bodyheight = $(document).height();
        $("#sidebar").height(bodyheight);
    }); });
    

提交回复
热议问题