Position fixed not working on Windows Safari

Mladen Janjetovic picture Mladen Janjetovic · Mar 4, 2014 · Viewed 20.3k times · Source

I had a problem with gallery that is position:fixed; and the site content is scrolling over it. That position fixed worked in every single browser except in Safari on Windows 7 (yes it worked even in IE8, and Safari on Mac).

Top is defined, but yet it still act as a position relative and scroll down with the rest of the content.

Answer

Mladen Janjetovic picture Mladen Janjetovic · Mar 4, 2014

The solution was to define the z-index on that position:fixed; element. For some reason only on Windows Safari position:fixed; didn't work until any z-index was defined.

Later, I discover that this bug is probably caused by -webkit-transform property that some of the fixed elements on page have.

Also, I found that setting this on that fixed element could help:

-webkit-transform: translateZ(0);