Is there a css alternative for for background-attachment: fixed for a background image set to cover

305 Views Asked by At

I have a <div> with a full screen background image for my slides. Due to a package I can't use background-attachment: fixed;. Without this property my image is distorted and in the slides. I can't use `background-attachment: fixed; here.

<div ref={parallaxDiv} className="image" />

.image {
  position: relative;
  width: 100%;
  height: 100%;
  background: url("https://placeimg.com/640/480/people") no-repeat center center;
  background-size: cover;
}

Is there an alternative for background-attachment: fixed; for a background image set to cover?

1

There are 1 best solutions below

0
norcal johnny On

does this work for you

.image {
 background: url("https://placeimg.com/640/480/people");
 background-position: center center;
 background-repeat: no-repeat;
 background-size: cover;
}