Hello, I am currently working on implementing a multi-item Carousel that moves one item at a time with each click. However, in my case, clicking the right arrow results in the entire slide changing. To help you understand better, I have provided a link to the reference below. If you spot any mistakes in my code, please do let me know.
HTML
<div class="row">
<div id="carousel" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel" data-slide-to="0" class="active"></li>
<li data-target="#carousel" data-slide-to="1"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<div class="d-none d-lg-block">
<div class="slide-box">
<img src="https://picsum.photos/285/200/?image=0&random" alt="First slide">
<img src="https://picsum.photos/285/200/?image=1&random" alt="First slide">
<img src="https://picsum.photos/285/200/?image=2&random" alt="First slide">
<img src="https://picsum.photos/285/200/?image=3&random" alt="First slide">
</div>
</div>
</div>
<div class="carousel-item">
<div class="d-none d-lg-block">
<div class="slide-box">
<img src="https://picsum.photos/285/200/?image=4&random" alt="Second slide">
<img src="https://picsum.photos/285/200/?image=5&random" alt="Second slide">
<img src="https://picsum.photos/285/200/?image=6&random" alt="Second slide">
<img src="https://picsum.photos/285/200/?image=7&random" alt="Second slide">
</div>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
CSS
.carousel {
width: 100%;
}
.slide-box {
display: flex;
justify-content: space-between;
}
.slide-box img {
-ms-flex: 0 0 25%;
flex: 0 0 25%;
max-width: 1600px;
}
.carousel-caption {
background-color: rgba(0, 0, 0, 0.5);
padding: 20px;
border-radius: .5rem;
}
Reference Link: CodePen
OUTPUT Image