--- title: Window.ondeviceorientation slug: Web/API/Window/ondeviceorientation translation_of: Web/API/Window/ondeviceorientation ---

{{ ApiRef() }}

简介

{{ event("deviceorientation") }}事件的事件处理程序,该事件包含了设备的相对旋转方向改变信息。

语法

window.ondeviceorientation = function(event) { ... };
window.addEventListener('deviceorientation', function(event) { ... });

规范

Specification Status Comment
{{SpecName('Device Orientation')}} {{Spec2('Device Orientation')}} Initial specification.

浏览器兼容性

{{ page("/en-US/docs/Web/API/DeviceOrientationEvent","Browser_compatibility") }}

更多资料