Created
May 16, 2012 11:50
-
-
Save gpessia/2709785 to your computer and use it in GitHub Desktop.
iPad / iPhone on orientation change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onorientationchange = function(){ | |
var orientation = window.orientation; | |
// Look at the value of window.orientation: | |
if (orientation === 0){ | |
// iPad is in Portrait mode. | |
} | |
else if (orientation === 90){ | |
// iPad is in Landscape mode. The screen is turned to the left. | |
} | |
else if (orientation === -90){ | |
// iPad is in Landscape mode. The screen is turned to the right. | |
} | |
else if (orientation === 180){ | |
// Upside down portrait. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment