1

I'm having a problem with an app.

I'm trying to make the marginLeft of a div id="bubble" vary based on the orientation of the phone or tablet, specifically what angle it's on.

I know I'm supposed to use accelerometer data but I don't know how to get angle data from it or apply said data to the css.

James
  • 11
  • 1
  • 1
    Did you try to google it? http://stackoverflow.com/questions/4474508/access-accelerometer-via-javascript-in-android – Prusse Feb 12 '15 at 14:05
  • unfortunately yes I have over 10 tabs open on the subject. Whenever I open a new link however I mostly get vague titles on what certain details are named. what I need to find out is how to take that data and apply it to a css margin. – James Feb 12 '15 at 17:29
  • Does [DeviceOrientationEvent](http://w3c.github.io/deviceorientation/spec-source-orientation.html#deviceorientation) work for fetching the orientation data ([MDN entry](https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent))? I think you will need to change the relevant objects' style directly (jQuery could make that code simpler) in that event handler. – Prusse Feb 13 '15 at 11:15

0 Answers0