Javascript calls different style sheet methods based on the iphone screen direction, javascriptiphone
This example describes how to use javascript to call different style sheets on the iphone screen. Share it with you for your reference. The details are as follows:
When the iphone screen is rotated, this JS Code can dynamically call different styles to adapt to screen changes.
<Script type = "text/javascript"> function orient () {switch (window. orientation) {case 0: document. getElementById ("orient_css "). href = "css/iphone_portrait.css"; break; case-90: document. getElementById ("orient_css "). href = "css/iphone_landscape.css"; break; case 90: document. getElementById ("orient_css "). href = "css/iphone_landscape.css"; break;} window. onload = orient (); </script>
I hope this article will help you design javascript programs.