androidiosdom-eventsmobile-website

Is it possible to receive tilt events in JavaScript on mobile Webkit for iOS or Android phones?


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.


Solution

  • You are looking for HTML5 DeviceOrientation and DeviceMotion events. Most modern smartphone browsers support these events now.

    You might find useful information here: https://mobiforge.com/design-development/html5-mobile-web-device-orientation-events