我正在为移动设备制作网站。在 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();