JavaScript – Mobile Orientation Detection

 
JavaScript – Mobile Orientation Detection
 

 
   <script type="text/javascript" language="javascript">
 
      window.onload = OrientationUpdate;
      window.onorientationchange = OrientationUpdate;
 
      function OrientationUpdate() {
 
         if(window.orientation == 180 || window.orientation == 0){
            // vertical orientation code
         } else if (window.orientation == 90 || window.orientation == -90) {
            // horizontal orientation code
         }
 
      }
 
   </script>