Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fixed positioning/z-index issue in mobile safari

So the site in question: http://kaye.at/baby

The main content below scrolls up over the top of the countdown and under the navigation which are both fixed elements. This works fine on desktop but on mobile safari, the content scrolls behind the countdown as the user moves up but once touch is released, it pops in front.

Just wondering whether this is a bug or it is something that can be fixed?

Here's the CSS:

#header { position: fixed; width: 100%; top: 0px; z-index: 10; } #content { width: 100%; position: relative; top: 650px; z-index: 7; } #banner { position: fixed; width: 100%; position: fixed; background: url('http://kaye.at/baby/img/stork.jpg') no-repeat center bottom #fff;  padding-top: 185px; z-index: 1; } #defaultCountdown { max-width: 70%; height: auto; } 

And HTML (main structure):

<div id="header">     <div id="nav">         <ul>             <li><a class="active" href="index.php">START</a></li>             <li><a href="ultrasound-images.php">ULTRASOUND PICS</a></li>             <li><a href="pinkorblue.php">PINK OR BLUE?</a></li>         </ul>     </div> </div>  <div id="banner">    <div id="defaultCountdown"></div> </div>  <div id="content"> </div> 
like image 474
user1393984 Avatar asked Aug 16 '13 10:08

user1393984


People also ask

Does Safari support Z-index?

Bookmark this question. Show activity on this post. The Z-index isn't rendering properly on Safari - but it is working fine on Chrome and Firefox.

How do you fix Z-index issues?

To sum up, most issues with z-index can be solved by following these two guidelines: Check that the elements have their position set and z-index numbers in the correct order. Make sure that you don't have parent elements limiting the z-index level of their children.

Why Z-Index property is not working?

z-index only works on positioned elements (relative, absolute, fixed, sticky) so if you set a z-index on an element with a static position, it won't work.

Does Z-Index work with fixed?

Note: z-index only works on positioned elements (position: absolute, position: relative, position: fixed, or position: sticky) and flex items (elements that are direct children of display:flex elements).


1 Answers

Ugh amazing. Just had to add:

-webkit-transform: translate3d(0,0,0); 

to the #content div.

like image 105
user1393984 Avatar answered Oct 02 '22 12:10

user1393984