Tryit Editor v1.8

Source Code:
<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="../../code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"> <script src="../../code.jquery.com/jquery-1.8.3.min.js"></script> <script src="../../code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> <script> $(document).on("pageinit",function(event){ $(window).on("orientationchange",function(){ if(window.orientation == 0) { $("p").text("The orientation has changed to portrait!").css({"background-color":"yellow","font-size":"300%"}); } else { $("p").text("The orientation has changed to landscape!").css({"background-color":"pink","font-size":"200%"}); } }); }); </script> </head> <body> <div data-role="page"> <div data-role="header"> <h1>The orientationchange Event</h1> </div> <div data-role="content"> <p>Try to rotate your device!</p> <p><b>Note:</b> You must use a mobile device, or a mobile emulator to see the effect of this event.</p> </div> <div data-role="footer"> <h1>Footer Text</h1> </div> </div> </body> </html>
Result:
W3Schools.com - Try it yourself