Snippets Animation

Bootstrap 5 Product Card with Hover Zoom

An e-commerce product card with a zoom-on-hover photo, discount badge, wishlist toggle, colour swatches and an add-to-cart button that confirms the action.

Bootstrap 5 No jQuery Aug 2020 2.1K views

<section class="wdw-stage">
  <div class="container" style="max-width:980px">
    <article class="wdw-card product overflow-hidden" data-imgs='{"graphite":["https://images.unsplash.com/photo-1546435770-a3e426bf472b?auto=format&fit=crop&w=1000&q=80","Black headphones on a white desk"],"stone":["https://images.unsplash.com/photo-1618366712010-f4ae9c647dcb?auto=format&fit=crop&w=1000&q=80","Headphones on a warm stone backdrop"],"cloud":["https://images.unsplash.com/photo-1583394838336-acd977736f90?auto=format&fit=crop&w=1000&q=80","Wired headphones on a white background"]}'>
      <div class="row g-0">
        <div class="col-md-6 product-gallery p-3 p-md-4 bg-body-tertiary">
          <div class="product-media position-relative rounded-4 overflow-hidden">
            <span class="badge rounded-pill text-bg-danger position-absolute top-0 start-0 m-3 px-3 py-2 fs-6 fw-bold d-inline-flex align-items-center" style="height:44px">-20%</span>
            <button type="button" class="btn btn-light rounded-circle position-absolute top-0 end-0 m-3 p-0 shadow-sm" style="width:44px;height:44px" id="wishBtn" aria-pressed="false" aria-label="Add to wishlist">
              <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.7l-1-1.1a5.5 5.5 0 0 0-7.8 7.8l1 1L12 21l7.8-7.6 1-1a5.5 5.5 0 0 0 0-7.8Z"/></svg>
            </button>
            <img src="https://images.unsplash.com/photo-1546435770-a3e426bf472b?auto=format&fit=crop&w=1000&q=80" alt="Black headphones on a white desk" class="product-img" id="productImg" width="1000" height="1000">
          </div>
          <div class="d-flex gap-2 mt-3"><button type="button" class="thumb is-on" data-color="graphite" aria-label="Show Graphite view"><img src="https://images.unsplash.com/photo-1546435770-a3e426bf472b?auto=format&fit=crop&w=200&h=200&q=70" alt="" width="72" height="72"></button><button type="button" class="thumb" data-color="stone" aria-label="Show Stone view"><img src="https://images.unsplash.com/photo-1618366712010-f4ae9c647dcb?auto=format&fit=crop&w=200&h=200&q=70" alt="" width="72" height="72"></button><button type="button" class="thumb" data-color="cloud" aria-label="Show Cloud view"><img src="https://images.unsplash.com/photo-1583394838336-acd977736f90?auto=format&fit=crop&w=200&h=200&q=70" alt="" width="72" height="72"></button></div>
        </div>
        <div class="col-md-6 p-4 p-md-5 d-flex flex-column justify-content-center">
          <span class="wdw-eyebrow">Audio</span>
          <h1 class="wdw-heading h2 mt-1 mb-2">COX Wireless Headphones</h1>
          <div class="d-flex align-items-center gap-2 small mb-3" role="img" aria-label="Rated 4.6 out of 5 from 218 reviews"><span class="d-inline-flex gap-1 text-warning" aria-hidden="true"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="1.75" stroke-linejoin="round" aria-hidden="true"><path d="m12 2.5 2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9Z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="1.75" stroke-linejoin="round" aria-hidden="true"><path d="m12 2.5 2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9Z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="1.75" stroke-linejoin="round" aria-hidden="true"><path d="m12 2.5 2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9Z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="1.75" stroke-linejoin="round" aria-hidden="true"><path d="m12 2.5 2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9Z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linejoin="round" aria-hidden="true"><path d="m12 2.5 2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9Z"/></svg></span><span class="wdw-muted" aria-hidden="true">4.6 (218 reviews)</span></div>
          <p class="wdw-muted mb-4">40-hour battery, active noise cancelling and plush memory-foam cushions for all-day comfort.</p>
          <div class="mb-4"><span class="display-6 fw-bolder">$99</span><span class="wdw-muted text-decoration-line-through ms-2">$124</span></div>
          <div class="mb-4">
            <div class="small fw-semibold mb-2">Colour: <span id="colorName" class="wdw-muted fw-normal">Graphite</span></div>
            <div class="d-flex gap-3" role="radiogroup" aria-label="Colour"><button type="button" class="swatch is-on" style="--c:#1f2937" role="radio" aria-checked="true" aria-label="Graphite" data-color="graphite"></button><button type="button" class="swatch" style="--c:#c9b6a8" role="radio" aria-checked="false" aria-label="Stone" data-color="stone"></button><button type="button" class="swatch" style="--c:#e5e7eb" role="radio" aria-checked="false" aria-label="Cloud" data-color="cloud"></button></div>
          </div>
          <button type="button" class="btn btn-primary rounded-pill w-100" id="addBtn"><svg class="d-none" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m5 12 5 5 9-10"/></svg><span id="addLabel">Add to cart</span></button>
          <div class="visually-hidden" role="status" aria-live="polite" id="addStatus"></div>
        </div>
      </div>
    </article>
  </div>
</section>

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