More height hacks for iPhone

This commit is contained in:
Sam 2017-09-28 18:05:42 +10:00
parent 30fa5379ce
commit cfed431ef2
1 changed files with 30 additions and 15 deletions

View File

@ -17,25 +17,40 @@ function calcHeight() {
let withoutKeyboard = window.innerHeight - 270; let withoutKeyboard = window.innerHeight - 270;
const min = 270; const min = 270;
// portrait
if (window.screen.height > window.screen.width) {
// iPhone SE
if (window.screen.height === 568) {
withoutKeyboard = 270;
}
// iPhone 6/7/8 // iPhone 6/7/8
if (window.innerHeight === 553) { if (window.screen.height === 667) {
withoutKeyboard = 308; withoutKeyboard = 295;
} }
// iPhone 6/7/8 plus // iPhone 6/7/8 plus
if (window.innerHeight === 622) { if (window.innerHeight === 736) {
withoutKeyboard = 360; withoutKeyboard = 360;
} }
// iPad landscape, so we have a bigger keyboard // iPad can use innerHeight cause it renders nothing in the footer
if (window.innerHeight > 920) {
withoutKeyboard -= 45;
}
} else {
// landscape
//
// iPad, we have a bigger keyboard
if (window.innerWidth > window.innerHeight && window.innerHeight > 665) { if (window.innerWidth > window.innerHeight && window.innerHeight > 665) {
withoutKeyboard -= 128; withoutKeyboard -= 128;
} }
}
// iPad portrait also has a bigger keyboard // iPad portrait also has a bigger keyboard
if (window.innerWidth < window.innerHeight && window.innerHeight > 920) {
withoutKeyboard -= 45;
}
return Math.max(withoutKeyboard, min); return Math.max(withoutKeyboard, min);
} }