简体   繁体   中英

Fix html element regardless device orientation and motion

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

垂直 天使 横

How can I do it?
Thanks!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM