orientationchange

orientationchange事件在设备的纵横方向改变时触发。

Bubbles No
Cancelable No
Interface Event
Event handler onorientationchange

示例

你可以在addEventListener 方法中使用 orientationchange 事件:

window.addEventListener("orientationchange", function() {
  console.log("the orientation of the device is now " + screen.orientation.angle);
});

或者使用 onorientationchange 事件处理程序属性:

window.onorientationchange = function() {
  console.log("the orientation of the device is now " + screen.orientation.angle);
};

规范

规范 状态
Compatibility Standard
orientationchange
Living Standard

浏览器兼容性

BCD tables only load in the browser