Search code examples
ipadmobile-safariios6

iOS6 Safari orientation change bug?


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.

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

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

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?


Solution

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

    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!