iOS 7 iPad Safari Landscape Layout Discrepancy
When using an iOS 7 iPad in landscape mode, a puzzling issue arises with web apps where window.innerHeight and window.outerHeight don't align. This 20px difference results in navigation elements being obscured and absolute positioning being misaligned at the bottom of the screen.
To address this issue and prevent it from interfering with user experience, a workaround can be implemented. By absolutely positioning the body element specifically in iOS 7:
body { position: absolute; bottom: 0; height: 672px !important; }
Regrettably, this approach simply shifts the extra space to the top of the page instead of resolving it. An alternative solution that has proven effective is modifying the positioning to fixed:
@media (orientation:landscape) { html.ipad.ios7 > body { position: fixed; bottom: 0; width:100%; height: 672px !important; } }
Additionally, a script can be used to detect iPad devices running iOS 7:
if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) { $('html').addClass('ipad ios7'); }
The above is the detailed content of Here are a few question-based article titles that encapsulate the content: Direct and Informative: * Why is window.innerHeight Different from window.outerHeight in iOS 7 iPad Landscape Mode? * How t. For more information, please follow other related articles on the PHP Chinese website!