codecamp

window属性:ondeviceorientation

ondeviceorientation属性

ondeviceorientation属性表示deviceorientation事件的事件处理程序,其中包含有关相对设备方向更改的信息。

ondeviceorientation属性语法

window.ondeviceorientation = functionevent{...};
window.addEventListener('deviceorientation'functionevent{...});

规范

规范状态注释
Device Orientation Events(设备方向事件)
Working Draft
初始规格

浏览器兼容性

  • 电脑端
特征Chrome
Edge
Firefox(Gecko)
Internet ExplorerOpera
Safari(WebKit)
基本支持支持:7.0 [1]支持支持:6 [2]
构造函数支持:59
  • 移动端
特征Android WebviewChrome for AndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
基本支持支持 [1]支持 [1]支持支持:6 [2]不支持不支持支持:4.2
构造函数支持:59支持:59?????

注释:

[1]在版本50之前,Chrome为此事件提供绝对值而不是相对值。仍然需要绝对值的开发人员可以使用该ondeviceorientationabsolute事件。

[2] Firefox 3.6,4和5支持mozOrientation而不是标准DeviceOrientationEvent接口

window属性:ondevicemotion
window属性:ondeviceorientationabsolute
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定