We Recommend

Essential ActionScript 3.0 Essential ActionScript 3.0
The book focuses on the core language and object-oriented programming, but also adds a deep look at the centerpiece of Flash Player's new API: display programming. Enjoy hundreds of brand new pages covering exciting new language features, such as the DOM-based event architecture, E4X, and namespaces--all brimming with real-world sample code.


Posted By

conspirator on 10/02/08


Tagged

css javascript textmate iphone portrait landscape orientation CSS-Tricks


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

jamesming
SpinZ


Load Specific Stylesheets for iPhone depending on Orientation


Published in: Other 


  1. <link rel="stylesheet" type="text/css" href="stylesheets/iphone_portrait.css" id="orient_css">
  2.  
  3. <script type="text/javascript" charset="utf-8">
  4. function orient()
  5. {
  6. switch(window.orientation){
  7. case 0: document.getElementbyId("orient_css").href = "stylesheets/iphone_portrait.css";
  8. break;
  9.  
  10. case -90: document.getElementbyId("orient_css").href = "stylesheets/iphone_landscape.css";
  11. break;
  12.  
  13. case 90: document.getElementbyId("orient_css").href = "stylesheets/iphone_landscape.css";
  14. break;
  15. }
  16. }
  17. window.onload = orient();
  18. </script>
  19.  
  20. <body onorientationchange="orient();">

Report this snippet 

You need to login to post a comment.