Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a bug in the new iOS 7.1 minimal-ui viewport setting?

The new "minimal ui" setting in iOS 7.1 is great for landscape websites. My web app uses a fullscreen, absolute positioned div for its content, to give it an app-like feeling. But Safari seems to add just the height of the URL bar at the bottom. I have tried this on different iPhones, same result...

Here is how it looks after the pages loaded: space at bottom after load

Is this a bug or something I am doing wrong or missing?

Click for example (view on iPhone with iOS >= 7.1)

like image 825
Dafen Avatar asked Mar 24 '14 11:03

Dafen


1 Answers

I had same problem with iPhone5+ios7.1+minimal-ui. This code successfully fixes this trouble.

window.addEventListener('scroll', function () {
    // Do not scroll when keyboard is visible 
    if (document.activeElement === document.body && window.scrollY > 0) {
        document.body.scrollTop = 0;
    }
}, true);
like image 171
Alexander Koleda Avatar answered Nov 06 '22 07:11

Alexander Koleda