When you set background-attachment to fixed in CSS, you get big FPS drops from the repaints (at least on Chrome, Firefox seems to handle it perfectly). There is a workaround that works perfectly and doesn't require setting that property, something like:
&:before { content: ' '; position: fixed; // instead of background-attachment width: 100%; height: 100%; top: 0; left: 0; background: url(${background}) no-repeat center center; background-size: cover; will-change: transform; // creates a new paint layer z-index: -1; }
However, I can't think of any way to replicate this using gatsby-background-image. Could it be possible?
Closing this as I found that simply using !important on the before and after pseudoselectors overrides the default values and allows to apply this workaround.
When you set background-attachment to fixed in CSS, you get big FPS drops from the repaints (at least on Chrome, Firefox seems to handle it perfectly). There is a workaround that works perfectly and doesn't require setting that property, something like:
&:before { content: ' '; position: fixed; // instead of background-attachment width: 100%; height: 100%; top: 0; left: 0; background: url(${background}) no-repeat center center; background-size: cover; will-change: transform; // creates a new paint layer z-index: -1; }
However, I can't think of any way to replicate this using gatsby-background-image. Could it be possible?