HTML and CSS Reference
In-Depth Information
Notice that an event listener is being added to the window object for the orientationchange event. If a device
changes orientation, it will broadcast this event, which can be adjusted for. Inside our function, notice that window.
orientation , a native property of the window object, is being checked for. If you find that it returns a 0 or 180, you
know that the device is in portrait, as shown in Figure 8-11 .
Figure 8-11. A device in portrait orientation
Otherwise, it's either 90 or −90, which means the device is in landscape orientation, as in Figure 8-12 .
Search WWH ::

Custom Search