Snippets Accordion

Bootstrap 5 Horizontal Accordion with Photo Panels

A row of photo panels that expands horizontally as you select one, revealing a short description, and stacks into a vertical accordion on phones.

Bootstrap 5 No jQuery Mar 2020 3.3K views

<section class="wdw-stage">
  <div class="container" style="max-width:1080px">
    <div class="text-center mb-4">
      <span class="wdw-eyebrow">Destinations</span>
      <h2 class="wdw-heading display-6 mt-1 mb-2">Pick your kind of getaway</h2>
      <p class="wdw-muted mb-0">Select a panel to expand it.</p>
    </div>
    <div class="wdw-hacc" id="wdwHacc">
      <article class="wdw-hacc-item is-active" style="--img:url('https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=1200&q=70')">
        <h3 class="wdw-hacc-head m-0">
          <button type="button" class="wdw-hacc-btn" aria-expanded="true" aria-controls="wdwPanel0" id="wdwBtn0">
            <span class="wdw-hacc-num">01</span>
            <span class="wdw-hacc-title">Mountains</span>
          </button>
        </h3>
        <div class="wdw-hacc-body" id="wdwPanel0" role="region" aria-labelledby="wdwBtn0">
          <div class="wdw-hacc-inner">
            <h4 class="h3 fw-bold mb-2">Alpine routes</h4>
            <p class="mb-3">Summit trails and ridge walks, from easy half-days to multi-day traverses with mountain huts.</p>
            <a href="#" class="btn btn-light btn-sm rounded-pill px-3">Explore mountains</a>
          </div>
        </div>
      </article>
      <article class="wdw-hacc-item" style="--img:url('https://images.unsplash.com/photo-1441974231531-c6227db76b6e?auto=format&fit=crop&w=1200&q=70')">
        <h3 class="wdw-hacc-head m-0">
          <button type="button" class="wdw-hacc-btn" aria-expanded="false" aria-controls="wdwPanel1" id="wdwBtn1">
            <span class="wdw-hacc-num">02</span>
            <span class="wdw-hacc-title">Forests</span>
          </button>
        </h3>
        <div class="wdw-hacc-body" id="wdwPanel1" role="region" aria-labelledby="wdwBtn1">
          <div class="wdw-hacc-inner">
            <h4 class="h3 fw-bold mb-2">Woodland escapes</h4>
            <p class="mb-3">Quiet canopy trails, forest cabins and guided dawn walks for a slower kind of weekend.</p>
            <a href="#" class="btn btn-light btn-sm rounded-pill px-3">Explore forests</a>
          </div>
        </div>
      </article>
      <article class="wdw-hacc-item" style="--img:url('https://images.unsplash.com/photo-1501785888041-af3ef285b470?auto=format&fit=crop&w=1200&q=70')">
        <h3 class="wdw-hacc-head m-0">
          <button type="button" class="wdw-hacc-btn" aria-expanded="false" aria-controls="wdwPanel2" id="wdwBtn2">
            <span class="wdw-hacc-num">03</span>
            <span class="wdw-hacc-title">Lakes</span>
          </button>
        </h3>
        <div class="wdw-hacc-body" id="wdwPanel2" role="region" aria-labelledby="wdwBtn2">
          <div class="wdw-hacc-inner">
            <h4 class="h3 fw-bold mb-2">Lakeside stays</h4>
            <p class="mb-3">Still water, kayaks at sunrise and lodges with a dock, a short drive from the city.</p>
            <a href="#" class="btn btn-light btn-sm rounded-pill px-3">Explore lakes</a>
          </div>
        </div>
      </article>
      <article class="wdw-hacc-item" style="--img:url('https://images.unsplash.com/photo-1507525428034-b723cf961d3e?auto=format&fit=crop&w=1200&q=70')">
        <h3 class="wdw-hacc-head m-0">
          <button type="button" class="wdw-hacc-btn" aria-expanded="false" aria-controls="wdwPanel3" id="wdwBtn3">
            <span class="wdw-hacc-num">04</span>
            <span class="wdw-hacc-title">Coasts</span>
          </button>
        </h3>
        <div class="wdw-hacc-body" id="wdwPanel3" role="region" aria-labelledby="wdwBtn3">
          <div class="wdw-hacc-inner">
            <h4 class="h3 fw-bold mb-2">Coastal getaways</h4>
            <p class="mb-3">Cliff paths, empty beaches and small harbour towns, best explored from May to September.</p>
            <a href="#" class="btn btn-light btn-sm rounded-pill px-3">Explore coasts</a>
          </div>
        </div>
      </article>
    </div>
  </div>
</section>

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

Free to use in personal and commercial projects under the MIT license.