--- 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") }}