2016-02-10 81 views

回答

1

如上所述,您可以使用window.orientation。例如:

switch(window.orientation) 
       { 
        case 0: 
         //"Portrait" 
        break; 

        case -90: 
         //"Landscape (right, screen turned clockwise)" 
        break; 

        case 90: 
         //"Landscape (left, screen turned counterclockwise)" 
        break; 

        case 180: 
         //"Portrait (upside-down portrait)" 
        break; 

       } 

欲瞭解更多信息使用`window.orientation`看到here

+0

謝謝! http://www.williammalone.com/articles/html5-javascript-ios-orientation/這也不錯。 –