javascript - iOS 网络应用程序 : Rotate the body with the orientation change

标签 javascript html ios css orientation

我有一个 iOS 网络应用程序游戏,我设计的像素完美,所以它只能在纵向模式下运行(在横向模式下,一半的游戏在屏幕下方)。我想这样做,如果用户旋转设备,网络应用程序也会旋转,迫使用户将其旋转回纵向模式。我知道我可以使用“window.onorientationchange”检测方向变化,并且我可以使用 orient CSS 属性更改基于方向的样式:body[orient="landscape"] 或 body[orient="portrait"]。现在我只需要知道如何在保持布局的同时旋转整个 body 。任何帮助将不胜感激!

最佳答案

使用 css 对 body 应用旋转变换。

 -webkit-transform:rotate(180deg);

关于javascript - iOS 网络应用程序 : Rotate the body with the orientation change,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13775867/

相关文章:

javascript - Datetimepicker jQuery 自定义 CSS

iphone - 如果该部分为空,是否有任何正确的方法可以从 CGPoint 确定表中的部分编号?

javascript - 平均堆栈模式

javascript - 使用javascript修改复选框

javascript - 是否可以使用 objective-c 从 parse.com 检索数据并将其显示在网站上?

html - 我怎样才能用 html 和 css 使 div 一个在另一个下面?

html - 子组合器和跨度

ios - 如何只为 UILabel 的左上角设置 cornerRadius?

iOS文件上传-原始文件名

javascript - setSelectionRange 适用于输入字段,但如何将光标放在可内容编辑字段的末尾?