2012-09-17 4 views
1

내 페이지는 가로 모드에서는 잘 작동하지만 세로 모드에서는 약간 축소 한 다음 화면에 맞춰야합니다. 그래서 축소 자바 스크립트를 작성하거나 내가iPad 회전시 자바 스크립트 자동 축척

if(navigator.platform == 'iPad') { 
     window.onorientationchange = function() { 
      var orientation = window.orientation; 
      // Look at the value of window.orientation: 
      if (orientation === 0) { 
       alert("iPad is in Portrait mode."); 
       // my code goes here 
       var viewportmeta = document.querySelector('meta[name="viewport"]'); 
       viewportmeta.content = 'width = 1003,initial-scale = 0.5, maximum-scale = 2.0, minimum-scale=0.7'; 

      } 
      else if (orientation === 90) { 
       // iPad is in Landscape mode. The screen is turned to the left. 
      } 
      else if (orientation === -90) { 
       // iPad is in Landscape mode. The screen is turned to the right. 
      } 
     } 

    } 

은 내가 <meta name="viewport" content="width=640"> 사용했다 단지 scale = 0.5;

+0

JS, 정말요? 내 사이트는 항상 '를 사용할 때 두 방향 모두에서 작동합니다. – feeela

답변

0

에서 잘 보이는 세로 모드로 회전 할 때 내 페이지를 축소하려는 모든이 해결

관련 문제