How to change height div on window resize?

后端 未结 6 2080
醉话见心
醉话见心 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:42

    In addition to what others have said make sure you extract the event handler code into a separate function and call it from ready and resize event handlers. That way if you add some more code or need to bind it to other events you will have only one place where to change code logic.

提交回复
热议问题