Looking for a plugin for realtime detection of the orientation of a mobile device using JavaScript?
I wrote a small jQuery plugin that allows you will bind to the window and attach the current mobile device orientation to the body using either 'portrait' or 'landscape' in the body tag. This will allow you apply CSS rules based on the orientation.
Source Code:
https://github.com/bryanpieper/mobilejs/blob/master/js/jquery-mobileorientation.js
When the device is in the portrait orientation, the body tag will have the 'portrait' class:
<body class="portrait" ...>
When the user rotates the device into the landscape orientation, the body class will be:
<body class="landscape" ...>
It leaves your custom classes in place and only replaces the two class names above.


ThePiepers.net serves the compressed JS and CSS files using the
Looking for a way to track your 404 pages using Google Analytics? Modify the ‘_trackPageview’ function call.