Is it possible to receive tilt events in JavaScript on mobile Webkit for iOS or Android phones? [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Improve this questionOriginal close reason(s) were not resolved
I've done some searching around and haven't found any good references for non-touch events provided to mobile browsers. Does anyone know of any good resources for what tilt events are supported or have experience with such things?
I'm really looking forward to adding some yaw controls.
You are looking for HTML5 DeviceOrientation and DeviceMotion events. Most modern smartphone browsers support these events now.
Here is a useful tutorial: http://www.html5rocks.com/en/tutorials/device/orientation/
[edited]
Unfortunately at this time, without running as a native app, events from the accelerometer are not available.
Documentation for: Supported Events for Safari on iOS
If you want these events, consider going for a native app, and checkout Phonegap - it has what you are looking for, supported by both iOS and Adroid, plus considerably more.
Here's a quick link: to get up'n the API docs
精彩评论