I have a site with a fixed header and slide-out sidebars. With iOS7 in portrait orientation, the fixed header stays fixed when the sidebar is visible, but on iOS8 the header pushes slightly upward depending on how far down you are scrolled. I need it to stay fixed.
See this jsbin: http://jsbin.com/xuyevi/2/
The main pieces are a header, a sidebar, and the main content. The header is fixed to the top of the screen using fixed position and has a z-index that keeps it above the content when you are scrolling.
The sidebar is fixed to the left side of the screen, and is initially hidden by being translated left by its own width.
To open the sidebar, each of the header, content, and sidebars are translated to the right by the width of the sidebar.
Again, this works perfectly on iOS7 and all other browsers that support translate3d, and it even works correctly in iOS8 when in landscape orientation. But in iOS8 in portrait, the fixed header will slide off the screen based on how far down the user is scrolled.
Further, using the Safari inspector shows that the menu items on screen are offset from their expected positions. I.e. selecting an element in the inspector highlights an area on the screen that is offset from the actual location where it's rendered.
Has anyone else run into this? Anyone know a fix?
EDIT: The inspector thinks that the fixed position header is exactly where it should be, even though it's actually getting pushed off screen.
position: fixed
the container width was about4/3
bigger than its parent. Usingposition: -webkit-sticky
didn't have this problem, but didn't work in my case (had trouble with opacity / background-image). If/When I solve this I'll post an answer here. – Grey