about orientation.SOS…

about orientation.SOS…

BY 13 Jan 2013 Web Application Development

 My web application needs to support orientation feature.I put the code like this

 

  1. (function(){  
  2. var init = function() {  
  3.   var updateOrientation = function() {  
  4.     var orientation = window.orientation;  
  5.       
  6.     switch(orientation) {  
  7.       case 90: case -90:  
  8.         orientation = ‘landscape’;  
  9.       break;  
  10.       default:  
  11.         orientation = ‘portrait’;  
  12.     }  
  13.       
  14.     // set the class on the HTML element (i.e. )  
  15.     document.body.parentNode.setAttribute(‘class’, orientation);  
  16.   };  
  17.     
  18.   // event triggered every 90 degrees of rotation  
  19.   window.addEventListener(‘orientationchange’, updateOrientation, false);  
  20.     
  21.   // initialize the orientation  
  22.   updateOrientation();  
  23. }  
  24.   
  25. window.addEventListener(‘DOMContentLoaded’, init, false);  
  26.   
  27. })(); 

 

and in my config.xml : <tizen:setting screen-orientation=”portrait” contextmenu=”enable”/> 

 

and I aslo tried like :<tizen:setting  contextmenu=”enable”/> 

 

Neither works well,it can’t detect the event of orientationchange .Souds like bind event failed.

Written by