In order to cope with the fragmentation of mobile device screens, a best practice when developing an mobile Web application is to use streaming layouts to ensure maximum possible use of limited screen space. Because of the directionality of the screen, when the user switches the direction of the screen, some design or implementation problems are highlighted-at least we need to handle the adaptation of the width of the current display element (which, of course, may be more than just this). Most of the time, we need to design the corresponding application display mode for different screen orientation, this time, it is very important to know the state of the device's vertical screen in real time.
http://dict.baidu.com/s?wd=%E6%B4%9B%E4%B8%BD%E8%AF%97%E4%B8%B0%E8%83%B8+++100%25%E4%B8%B0%E8%83%B8%E6%88%90% e5%8a%9f++%e6%b3%95%e5%9b%bd%e7%94%9f%e7%89%a9%e7%a7%91%e6%8a%80%e5%ae%8c%e7%be%8e%e7%bb%93%e5%90%88
Window.orientation Properties and Onorientationchange events
Window.orientation: This property gives the screen orientation of the current device, 0 for the vertical screen, plus and minus 90 for the horizontal screen (left and right) mode
Onorientationchange: This window event is triggered when the screen orientation is switched between the horizontal and vertical screens, using the same usage as traditional events
Screen orientation
Window.onorientationchange=function () {
if (window.orientation==0) {
Alert ("Vertical screen")
}else{
Alert ("Horizontal screen")
}
};
Mobile Web Development-handle the screen of a device