Skip to content

Instantly share code, notes, and snippets.

@benhuson
Last active April 22, 2016 10:10
Show Gist options
  • Save benhuson/8664741 to your computer and use it in GitHub Desktop.
Save benhuson/8664741 to your computer and use it in GitHub Desktop.
Fix iOS 7 iPad Safari Landscape innerHeight/outerHeight layout issue
/**
* Add ipad IOS7 Classes
* Allows us to temporariliy try to fix the slight scroll 100% hack.
* http://stackoverflow.com/questions/19012135/ios-7-ipad-safari-landscape-innerheight-outerheight-layout-issue
*/
if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) {
$('html').addClass('ipad ios7');
}
/**
* Fix for iPad iOS7 slight scroll on 100% body height
* http://stackoverflow.com/questions/19012135/ios-7-ipad-safari-landscape-innerheight-outerheight-layout-issue
*/
@media (orientation:landscape) {
html.ipad.ios7 > body {
position: fixed;
bottom: 0;
width: 100%;
height: 672px !important;
}
}
@undless
Copy link

undless commented Jul 22, 2014

Hi,

This trick worked perfectly for me too. Thanks benhuson.

jandelvo i think understand your point but for the moment there is no fullscreen mode on ipad IO7. But you're right, we should make it flexible.
I just suggest to add an orientation detection to your code because your code is setting a height even on portrait (the css use the media querie orientation:landscape).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment