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
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
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.
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