I'm trying to implement a Parallax scrolling effect on my Bootstrap 4 slider. However, every time the slider switches to the next image, the image needs to readjust itself into place. How can I avoid this?
.customOverlayText {
position: absolute;
color: white;
z-index: 2;
left: 0;
right: 0;
}
.carousel-inner .carousel-item {
height: 500px;
background-size: cover;
background-position: center center;
background-color: black;
background-attachment: fixed;
}
.general {
background-color: #f0f0f0;
padding-left: 200px;
padding-right: 200px;
padding-top: 50px;
padding-bottom: 50px;
}
@media only screen and (max-width: 1146px) {
.general {
padding-left: 50px;
padding-right: 50px;
}
}
<div class="carousel slide" data-pause="false" data-ride="carousel">
<div class="customOverlayText d-flex h-100 align-items-center justify-content-center">
<center>Overlay</center>
</div>
<div class="carousel-inner text-center">
<div class="carousel-item active" style="background-image:url(http://coopertimewell.com/testing/images/slider/1.jpg);"></div>
<div class="carousel-item" style="background-image:url(http://coopertimewell.com/testing/images/slider/2.jpg);"></div>
<div class="carousel-item" style="background-image:url(http://coopertimewell.com/testing/images/slider/3.jpg);"></div>
<div class="carousel-item" style="background-image:url(http://coopertimewell.com/testing/images/slider/4.jpg);"></div>
<div class="carousel-item" style="background-image:url(http://coopertimewell.com/testing/images/slider/5.jpg);"></div>
<div class="carousel-item" style="background-image:url(http://coopertimewell.com/testing/images/slider/6.jpg);"></div>
<div class="carousel-item" style="background-image:url(http://coopertimewell.com/testing/images/slider/7.jpg);"></div>
<div class="carousel-item" style="background-image:url(http://coopertimewell.com/testing/images/slider/8.jpg);"></div>
<div class="carousel-item" style="background-image:url(http://coopertimewell.com/testing/images/slider/9.jpg);"></div>
<div class="carousel-item" style="background-image:url(http://coopertimewell.com/testing/images/slider/10.jpg);"></div>
<div class="carousel-item" style="background-image:url(http://coopertimewell.com/testing/images/slider/11.jpg);"></div>
<div class="carousel-item" style="background-image:url(http://coopertimewell.com/testing/images/slider/12.jpg);"></div>
</div>
</div>
<center>
<div class="general" id="redGeneral">
<h2>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nullam eget felis eget nunc lobortis mattis aliquam faucibus. Dolor sit amet ...
Is it possible to incorporate text overlay in the Parallax scrolling effect as well?