1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
   | 
  function orientationChange() {     switch(window.orientation) {       case 0:              alert("肖像模式 0,screen-width: " + screen.width + "; screen-height:" + screen.height);             break;       case -90:              alert("左旋 -90,screen-width: " + screen.width + "; screen-height:" + screen.height);             break;       case 90:                alert("右旋 90,screen-width: " + screen.width + "; screen-height:" + screen.height);             break;       case 180:              alert("风景模式 180,screen-width: " + screen.width + "; screen-height:" + screen.height);           break;     }; };
 
  addEventListener('load', function(){     orientationChange();     window.onorientationchange = orientationChange; });
 
  |