Snippets Carousel

Bootstrap 5 Carousel with Scaling and Sliding Slides

A looping image carousel where the centre photo scales up and neighbours shrink and slide to the sides. Use the arrows, dots, keyboard or swipe.

Bootstrap 5 No jQuery Jan 2020 2.2K views

<section class="wdw-stage overflow-hidden">
  <div class="container text-center" style="max-width: 1100px">
    <span class="wdw-eyebrow">Gallery</span>
    <h1 class="wdw-heading h2 mt-1 mb-4">Scaling carousel</h1>
    <div class="cv" id="cv" role="region" aria-roledescription="carousel" aria-label="Landscape photos" tabindex="0">
      <div class="cv-track">
        <figure class="cv-slide" role="group" aria-roledescription="slide" aria-label="1 of 5">
          <img src="https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=900&q=75" alt="Alpine valley" loading="eager">
          <figcaption><strong>Alpine valley</strong><span>Alps, Switzerland</span></figcaption>
        </figure>
        <figure class="cv-slide" role="group" aria-roledescription="slide" aria-label="2 of 5">
          <img src="https://images.unsplash.com/photo-1469474968028-56623f02e42e?auto=format&fit=crop&w=900&q=75" alt="Misty sunrise valley" loading="eager">
          <figcaption><strong>Misty sunrise valley</strong><span>Dolomites, Italy</span></figcaption>
        </figure>
        <figure class="cv-slide" role="group" aria-roledescription="slide" aria-label="3 of 5">
          <img src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?auto=format&fit=crop&w=900&q=75" alt="Sunlit forest path" loading="eager">
          <figcaption><strong>Sunlit forest path</strong><span>Black Forest, Germany</span></figcaption>
        </figure>
        <figure class="cv-slide" role="group" aria-roledescription="slide" aria-label="4 of 5">
          <img src="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?auto=format&fit=crop&w=900&q=75" alt="Foggy ridge at dawn" loading="lazy">
          <figcaption><strong>Foggy ridge at dawn</strong><span>Lake District, UK</span></figcaption>
        </figure>
        <figure class="cv-slide" role="group" aria-roledescription="slide" aria-label="5 of 5">
          <img src="https://images.unsplash.com/photo-1501785888041-af3ef285b470?auto=format&fit=crop&w=900&q=75" alt="Lake and mountains" loading="lazy">
          <figcaption><strong>Lake and mountains</strong><span>Lake Bled, Slovenia</span></figcaption>
        </figure>
      </div>
      <button type="button" class="btn cv-nav cv-prev" aria-label="Previous slide"><i class="bi bi-arrow-left"></i></button>
      <button type="button" class="btn cv-nav cv-next" aria-label="Next slide"><i class="bi bi-arrow-right"></i></button>
    </div>
    <div class="cv-dots d-flex justify-content-center gap-2 mt-4" id="cvDots">
<button type="button" class="cv-dot" aria-label="Go to slide 1"></button>
<button type="button" class="cv-dot" aria-label="Go to slide 2"></button>
<button type="button" class="cv-dot" aria-label="Go to slide 3"></button>
<button type="button" class="cv-dot" aria-label="Go to slide 4"></button>
<button type="button" class="cv-dot" aria-label="Go to slide 5"></button>
    </div>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.