我如何才能将网页方向修改为仅限iPad和iPhone的纵向? [英] How can I fix the webpage orientation to Portrait only for iPad and iPhone?
问题描述
我为iPad开发了一个网络应用程序/网站,但我不能让它保持固定的纵向视图。
I have developed a web app/website for the iPad but I can not get it stay in a fixed portrait view only.
我不想旋转
我已经尝试过各种配置的视口设置,但仍然没有工作。
I've tried various configurations of the viewport settings but that still has not worked.
我不是很擅长JavaScript,所以复制粘贴选项将是最好的或CSS / HTML中的东西。
I'm not very good at JavaScript so a copy paste option would be best or something in CSS/HTML.
提前感谢。
推荐答案
不幸的是,没有办法明确锁定 Safari,您也可以从注释中的Alex上面的链接看到:
Unfortunately, there is no way to explicitly "lock" the orientation of a web-app in Mobile Safari, as you can also see from the link that Alex posted above in the comment:
但是,您可以有多个CSS文件用于不同的屏幕方向。有一个方便的JavaScript代码段,您可以在此处复制并粘贴:
However, you can have multiple CSS files for different screen orientations. There's a handy JavaScript snippet that you can copy-paste here:
http://www.catswhocode.com/blog/10-useful-code-snippets-to-develop-iphone-friendly-websites
这应该至少允许你围绕旋转设计,而不必使用JS而只是CSS。
This should at least allow you to design around the rotation without having to use JS but just CSS.
这篇关于我如何才能将网页方向修改为仅限iPad和iPhone的纵向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!