deviceorientation

deviceorientation 事件在方向传感器输出新数据的时候触发。其数据系传感器与地球坐标系相比较所得,也就是说在设备上可能会采用设备地磁计的数据。详情参考有关方向与运动信息的说明(Orientation and motion data explained)

常规信息

标准
Orientation
接口
DeviceOrientationEvent
冒泡
可取消
Target
DefaultView (window)
默认操作

属性

Property Type Description
target 只读 EventTarget The event target (the topmost target in the DOM tree).
type 只读 DOMString The type of event.
bubbles 只读 Boolean Whether the event normally bubbles or not
cancelable 只读 Boolean Whether the event is cancellable or not?
alpha 只读 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 只读 double (float) The current orientation of the device around the X axis; that is, how far the device is tipped forward or backward.
gamma 只读 double (float) The current orientation of the device around the Y axis; that is, how far the device is turned left or right.
absolute 只读 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 只读 EventTarget The event target (the topmost target in the DOM tree).
type 只读 DOMString The type of event.
bubbles 只读 Boolean Whether the event normally bubbles or not
cancelable 只读 Boolean Whether the event is cancellable or not?
功能 Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
基本功能支持 7.0 3.6[1] ? ? ?
功能 Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
基本功能支持 3.0 3.6[1] 未实现 12 4.2

[1] Firefox 3.6, 4, 和 5 支持 mozOrientation 这一类似 DeviceOrientation 的事件。

相关事件

参见

文档标签和贡献者