The deviceorientation
event is fired when fresh data is available from an orientation sensor about the current orientation of the device as compared to the Earth coordinate frame. This data is gathered from a magnetometer inside the device. See Orientation and motion data explained for details.
window
)Property | Type | Description | |||
---|---|---|---|---|---|
target Read only
| EventTarget | The event target (the topmost target in the DOM tree). | |||
type Read only
| DOMString | The type of event. | |||
bubbles Read only
| Boolean | Whether the event normally bubbles or not | |||
cancelable Read only
| Boolean | Whether the event is cancellable or not? | |||
alpha Read only
| double (float) | The current orientation of the device around the Z axis; that is, how far the device is rotated around a line perpendicular to the device. | |||
beta Read only
| double (float) | The current orientation of the device around the X axis; that is, how far the device is tipped forward or backward. | |||
gamma Read only
| double (float) | The current orientation of the device around the Y axis; that is, how far the device is turned left or right. | |||
absolute Read only
| boolean | This value is true if the orientation is provided as a difference between the device coordinate frame and the Earth coordinate frame; if the device can't detect the Earth coordinate frame, this value is false . | |||
Property | Type | Description | |||
target Read only
| EventTarget | The event target (the topmost target in the DOM tree). | |||
type Read only
| DOMString | The type of event. | |||
bubbles Read only
| Boolean | Whether the event normally bubbles or not | |||
cancelable Read only
| Boolean | Whether the event is cancellable or not? | |||
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
Basic support | 7.0 | 3.6[1] | ? | ? | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | 3.0 | 3.6[1] | No support | 12 | 4.2 |
[1] Firefox 3.6, 4, and 5 supported mozOrientation versus the standard DeviceOrientation
event.
DeviceMotionEvent
window.ondeviceorientation
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/Events/deviceorientation