0

I have an html element and want to keep it vertically oriented regardless mobile device rotation.
For example:

vertical angel horizontal

How can I do it?
Thanks!

vitalets
  • 4,675
  • 1
  • 35
  • 35
  • I think this is with regular HTML and JS not possible. But you can use `cordova` that extends the regular browser functionality. There are cordova plugins that let you read out the orientation of your device: http://plugins.telerik.com/cordova/plugin/screenorientation – Frank Roth Apr 21 '17 at 09:00

1 Answers1

0

Not sure about current browser support, but you could use accelerometer: How to access accelerometer/gyroscope data from Javascript?

Here's a demo too: http://www.albertosarullo.com/demos/accelerometer/

Please also note that auto screen orientation on your device may cause unexpected behaviour.

Community
  • 1
  • 1