Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

mc.onWindowResize(Function callback)

监听窗口尺寸变化事件

参数

属性类型默认值必填说明
callbackFunction400否窗口尺寸变化回调函数

callback(Object res) 回调参数

属性类型说明
sizeObjectwindowWidth / windowHeight, 变化后的窗口宽度,单位 px

示例代码:

mc.onWindowResize(function(res){
    console.log(res.size.windowWidth, res.size.windowHeight)
})