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
jQTouch checks it like so:
http://github.com/senchalabs/jQTouch/blob/master/jqtouch/jqtouch.js
You can also listen to onorientationchange events
See previous answer: Detect rotation of Android phone in the browser with JavaScript
You could do a simple check for the width of the document.
You could set it to a variable, and then check the variable against the native resolution of the iPad: 768px x 1024px in portrait.
you can try the solution, compatible with all browser.
Following is
orientationchange
compatibility pic: therefore, I author aorientaionchange
polyfill, it is a based on @media attribute to fix orientationchange utility library——orientationchange-fixand then, you can retrieve current state of orientation by
window.neworientation.current
and initial state of orientation bywindow.neworientation.init
.