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 can try the solution, compatible with all browser.
Following is orientationchange compatibility pic:
therefore, I author a orientaionchange polyfill, it is a based on @media attribute to fix orientationchange utility library——orientationchange-fix
window.addEventListener('orientationchange', function(){
if(window.neworientation.current === 'portrait|landscape'){
// do something……
} else {
// do something……
}
}, false);
and then, you can retrieve current state of orientation by window.neworientation.current and initial state of orientation by window.neworientation.init.