2
我正在爲移動設備製作網站。 在android和windows phone中,它會正確加載兩個方向。 在iPhone上改變方向時,它不加載新的CSS。 什麼是解決方案?如何在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的?告訴我們你的代碼或沒有人可以幫助你 – samrap