DOM event fired by window resize

后端 未结 5 2128
攒了一身酷
攒了一身酷 2021-02-10 04:34

I have a page that has a fairly complicated layout. When the page is initially opened there\'s a problem with the aligment of some of the elements. However, this problem can be

5条回答
  •  逝去的感伤
    2021-02-10 05:27

    For IE compatibility

    function fireResize(){
        if (document.createEvent) { // W3C
            var ev = document.createEvent('Event');
            ev.initEvent('resize', true, true);
            window.dispatchEvent(ev);
        }
        else { // IE
            element=document.documentElement;
            var event=document.createEventObject();
            element.fireEvent("onresize",event);
        }
    };
    fireResize();
    

提交回复
热议问题