手动触发js事件(原生)

          const fireOnThis = document.getElementsByTagName('body')
          const evObj = document.createEvent('MouseEvents')
          evObj.initMouseEvent('resize', true, true, window)
          fireOnThis[0].dispatchEvent(evObj)    

 

posted on 2017-08-07 21:08  宝清老窖  阅读(647)  评论(0编辑  收藏  举报