DOM event fired by window resize

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

    Can also be done with CustomEvent:

    var ev = new CustomEvent('resize'); //instantiate the resize event
    ev.initEvent('resize');
    
    window.dispatchEvent(ev); // fire 'resize' event!
    

提交回复
热议问题