2

While using background-attachment:fixed, I am finding issues with how Chrome is rendering the background image on retina screens only. Firefox and Safari work as intended. I have also noticed that I can get it to work in Chrome when I click the "Enable continuous page repainting" box in Developer Tools > Console > Rendering. This also causes severe performance issues when enabled though. The images render fine when it's changed from background-attachment:fixed to background-attachment:scroll, but then I lose the intended effect.

Any suggestions on a work around for this? Or will I have to target Chrome on retina devices and kill the functionality?

Here is a link to the problem with a screenshot:

https://code.google.com/p/chromium/issues/detail?id=366012

1 Answers1

0

I had the same issue, try this :

Demo here http://jsfiddle.net/dN4S4/493/

body{
    padding: 0;
    margin: 0;
}

#main{
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
}

#fixedElement{
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility:hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    margin:auto;
    z-index: -1;
    display: block;
}


.fullWidthImage{
    background: url("http://s.camptocamp.org/uploads/images/1255459227_450187593.jpg") no-repeat center center; 
    -webkit-background-size: 100%; 
    -moz-background-size: 100%; 
    -o-background-size: 100%; 
    background-size: 100%;
    background-size: cover;
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover;   
    overflow: hidden;
    width: 100%;
    height: 100%;  
    margin: 0; 
    padding: 0;
    position: relative;
}


.bottom{
    position: relative;
    top: 500px;
    width: 100%;
    height: 800px;
    background-color: purple;
    margin: 0;
    padding: 0;
}
<div id="main">
    <div id="fixedElement">
        <div class="fullWidthImage">
        </div>
    </div>
    <div class="bottom">
    </div>
</div>
Idov Mamane
  • 372
  • 1
  • 8
  • Your answer would be very useful had you shared which part of the above code actually fixed the problem. Not just fired back a working example, leaving everybody to guess. – Ryan Sep 30 '15 at 07:26