Skip to content

Instantly share code, notes, and snippets.

View mrbase's full-sized avatar

Ulrik Nielsen mrbase

View GitHub Profile
@mrbase
mrbase / jQuery.onOrientationChange.js
Created October 28, 2011 08:56
Triggers onorientationchange events.
(function() {
if (window.orientation) {
window.onorientationchange = function() {
var orientation = 'portrait';
if (window.orientation == 90 || window.orientation == -90) {
orientation = 'landscape';
}
$('html').addClass(orientation);
$('body').trigger(
'orientationchange', // the trigger