set div height using jquery (stretch div height)

前端 未结 6 1960
抹茶落季
抹茶落季 2020-12-04 17:37

I have 3 divs with ids header, content and footer. Header and footer has fixed height and they are styled to float on top and bottom.

6条回答
  •  情书的邮戳
    2020-12-04 18:30

    You can bind function as follows, instead of init on load

    $("div").css("height", $(window).height());
    $(​window​).bind("resize",function() {
        $("div").css("height", $(window).height());
    });​​​​
    

提交回复
热议问题