views:

38

answers:

2

I want to add an extra div if the ipad is in landscape mode. Is there some sort of if statement that could find this out?

Thanks

+1  A: 

You could do a simple check for the width of the document.

$(window).width();

You could set it to a variable, and then check the variable against the native resolution of the iPad: 768px x 1024px in portrait.

MoDFoX
Thats a good idea, I will try it tell you how it went!
cat
That is so far working great, Thank you!
cat
Excellent! Glad I could help.
MoDFoX
A: 

jQTouch checks it like so:

orientation = Math.abs(window.orientation) == 90 ? 'landscape' : 'portrait';

http://github.com/senchalabs/jQTouch/blob/master/jqtouch/jqtouch.js

You can also listen to onorientationchange events

See previous answer: http://stackoverflow.com/questions/1649086/detect-rotation-of-android-phone-in-the-browser-with-javascript

edtechdev