automatically detect web browser window width change?

前端 未结 8 1430
清酒与你
清酒与你 2021-02-01 16:20

i know that you with $(window).width() can get the size of the web browser.

i want to detect when the user change the size of his web browser so i could readjust the col

8条回答
  •  星月不相逢
    2021-02-01 17:10

    In MDN they give a really good Javascript standalone code:

    window.onresize = resize;
    
    function resize()
    {
     alert("resize event detected!");
    }

    If you need just this kind of functionality I would recommend to go for it.

提交回复
热议问题