Back to Top

How to Detect the Orientation of Ipad

Nowadays, Whether you’re developing a web application or an android based application, you need to use responsive design and code for the site which will be supported iPhone, iPad, Blackberry even the Android devices.Here I am going to show you how to detect the orientation of iPad and how to make changes as per orientation of iPad with javascript rather than CSS.

First Off, Ipad detects Portrait and landscape orientation.and we can go through a Media Queries with CSS3.CSS3 media queries allow us to change the layouts of the site by CSS with screen side detection.but sometimes it’s difficult to determine the orientation of Ipad device.

Must Read: Browser Detection with Joomla

For Ipad, we need to check, orientation change or detect orientation upon page loadings.Let’s have a look into the following code which give you a basic idea

onorientationchange is an event which is sent when the user changes the orientation of iOS and support on from iOS 1.1.1.

Also Read: Learn Responsive Web Design Online

For Page load event, Here I have called iPadOrientation () function on starting of code and when orientation of Ipad changed,window.onorientationchange is the orientation handling event which will call the function iPadOrientation when orientation of iPad is changed.

That’s it.

I hope this post will help you. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How to Protect file using .htaccess

Posted on 9 years ago

Bhumi

How to use JavaScript Promise API?

Posted on 7 years ago

Bhumi

How to use CONST keyword in PHP

Posted on 12 years ago

Bhumi

The Readers’ Poll – January 2013

Posted on 11 years ago

Bhumi