iPhone Orientation Javascript


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script type="text/javascript">
  2. function orient()
  3. {
  4. switch(window.orientation){
  5. case 0: document.getElementById("orient_css").href = "css/iphone_portrait.css";
  6. break;
  7.  
  8. case -90: document.getElementById("orient_css").href = "css/iphone_landscape.css";
  9. break;
  10.  
  11. case 90: document.getElementById("orient_css").href = "css/iphone_landscape.css";
  12. break;
  13.  
  14. }
  15.  
  16. window.onload = orient();
  17.  
  18.  
  19. </script>

URL: http://nettuts.com/tutorials/tools-and-tips/learn-how-to-develop-for-the-iphone/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.