iOS 9 Safari Viewport bug

老子叫甜甜 提交于 2019-12-02 04:33:56

问题


I'm working on the iPad version of a web project and am using Safari's web inspector to work with CSS layout etc. However I've tracked my bug to the viewport meta tag.

When an iPad Air with iOS 9.0 - 9.2 is in portrait mode the viewport meta rules are broken/ignored. Here is a screenshot of the issue from an iPad air iOS 9.2:

The Problem: When in portrait the computed width for the html and body tag is 768px yet there is a white space to the right that is about 300px. Also user-scalable=no does not apply. Fixed items like the nav and footer appear as 100% as seen in the image. Landscape is fine and all other devices / OS' are working as expected.

The website is Utilidata.com. Has anyone seen this behavior or know of a fix?

<meta name="viewport" content="width=device-height, initial-scale=1, user-scalable=no"/>

UPDATE: I'm seeing reddit people freaking out about iOS 9's viewport issues. However their shrink-to-fit=no solution doesn't fix.


回答1:


Make sure to incorporate below changes to meta > viewport:

  • Remove width=device-width and height=device-height
  • Also set *-scale to 1.0001 from 1.0.

-

<meta name="viewport" content="initial-scale=1.0001, minimum-scale=1.0001, maximum-scale=1.0001, user-scalable=no"/>

Worked well for me! Good Luck!!!



来源:https://stackoverflow.com/questions/34950251/ios-9-safari-viewport-bug

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