0
我发现找出设备的定向的方式(肖像,风景左,景观权,颠倒)通过监听加速计在iOS的Safari浏览器/ Web应用程序在iPhone和iPad
<body onorientationchange="updateOrientation();">
和在标头
function updateOrientation() {
switch(window.orientation) {
case 0:
// normal
// do some cool things...
break;
case -90:
// right
// do some cool things...
break;
case 90:
// left
// do some cool things...
break;
case 180:
// upside down
// do some cool things...
break;
}
}
但是它实际上可以找出一般加速度计的X/Y/Z值吗?