iOS6 Safari方向更改错误? [英] iOS6 Safari orientation change bug?

查看:97
本文介绍了iOS6 Safari方向更改错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Safari和iOS6中有一种罕见的行为。从横向更改为纵向时,视口会调整大小,但似乎没有正确定位水平。它向左移动了128px。

I'm having an rare behavior in Safari and iOS6. When changing from landscape to portrait, the viewport is resized, but it seems that is no correctly positioned horizontally. It's displaced exactly 128px to left.

我可以使用iOS6中的iPad3重现这种行为,访问www.google.com

I'm able to reproduce this behavior with an iPad3 in iOS6 going to www.google.com

如果您更改html的display属性,如下所示:

If you change the display property of the html like this:

document.querySelector(html)。style.display =none
document.querySelector(html)。style.display =block

document.querySelector("html").style.display = "none" document.querySelector("html").style.display = "block"

视口返回原点并正确显示。这就是为什么我认为这是一个错误。

the viewport returns to origin and its displayed correctly. That's why I think that this is a bug.

任何想法如何解决这个问题?

Any ideas how to fix this?

推荐答案

由于这个原因,我找到了解决方案:
http://www.tonylea.com/2010/safari-overflow-hidden-problem/

I found the solution thanks to this: http://www.tonylea.com/2010/safari-overflow-hidden-problem/

我有溢出:隐藏在我的HTML标签中,因为我有一些左右隐藏的旋转DIV,但似乎iOS6中的Safari不接受。设置位置:相对于HTML标签解决了我的问题!

I had overflow:hidden in my HTML tag, since I have some rotating DIVs hidden left and right, but it seems that Safari in iOS6 wasn't accepting that. Setting position:relative to HTML tag solved the problem for me!

这篇关于iOS6 Safari方向更改错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆