Reputation: 193
How can I detect an iOS devices orientation relative it's home button in JavaScript?
Upvotes: 0
Views: 66
Reputation: 15321
As mentioned, you can use window.orientation. For example:
switch(window.orientation)
{
case 0:
//"Portrait"
break;
case -90:
//"Landscape (right, screen turned clockwise)"
break;
case 90:
//"Landscape (left, screen turned counterclockwise)"
break;
case 180:
//"Portrait (upside-down portrait)"
break;
}
For more information see here
Upvotes: 1