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

跟風遠走 提交于 2019-12-18 12:32:49

问题


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:

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

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


回答1:


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);



回答2:


check out this post: Gray area visible when switching from portrait to landscape using iOS 7.1 minimal-ui

this fixed it for me:

window.scrollTo(0,0);

setting every time a resize event occurs.




回答3:


 $(window).resize(function(){
  document.body.scrollTop = 0;
})


来源:https://stackoverflow.com/questions/22607561/is-there-a-bug-in-the-new-ios-7-1-minimal-ui-viewport-setting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!