DOM event fired by window resize

后端 未结 5 2186
攒了一身酷
攒了一身酷 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:08

    I tried this in Chrome, Firefox and IE11, and it works:

    var evt = document.createEvent('UIEvents');
    evt.initUIEvent('resize', true, false, window, 0);
    window.dispatchEvent(evt);
    

提交回复
热议问题