【发布时间】:2013-08-06 16:51:45
【问题描述】:
我正在为移动设备制作网站。 在 android 和 windows phone 中,它正确加载了两个方向。 在 iPhone 上,当您更改方向时,它不会加载新的 CSS。 有什么解决办法?
解决方案:
<script type="text/javascript">
function orient()
{
switch(window.orientation){
case 0: document.getElementById("orient_css").href = "css/iphone_portrait.css";
break;
case -90: document.getElementById("orient_css").href = "css/iphone_landscape.css";
break;
case 90: document.getElementById("orient_css").href = "css/iphone_landscape.css";
break;
}
window.onload = orient();
【问题讨论】:
-
您是否使用媒体查询来调整大小? Javascript?向我们展示您的代码,否则没有人可以帮助您
标签: iphone css web orientation