--- title: Window.ondevicemotion slug: Web/API/Window/ondevicemotion tags: - API - Device Orientation - Firefox OS - Mobile - Motion - 移动端设备 translation_of: Web/API/Window/ondevicemotion ---
{{ ApiRef() }}
一个发送到窗口的{{ event("devicemotion")}}事件处理程序。
window.ondevicemotion = funcRef;
Where funcRef
is a reference to a function. This function receives a {{ domxref("DeviceMotionEvent") }} object describing the motion that occurred.
这里的funcRef
是一个函数的引用。这个函数接收一个{{ domxref("DeviceMotionEvent") }} 对象类型的参数描述发生的动作。
规范 | 状态 | 备注 |
---|---|---|
{{SpecName('Device Orientation')}} | {{Spec2('Device Orientation')}} | Initial specification. |
{{ page("/en-US/docs/Web/API/DeviceMotionEvent","Browser_compatibility") }}