# Stacking Cards Parallax

> Scroll-stacked cards with parallax and subtle rotation on the previous layer — cinematic storytelling sections.

**Definition:** Stacking Cards Parallax is a scroll UI animation from collections.html. It is built with HTML, CSS, JavaScript, and GSAP, ships with a live preview, and is free to copy into personal and commercial projects.

## Facts
- Category: Scroll
- Stack: HTML, CSS, JavaScript, and GSAP
- Added: 2026-08-03
- Canonical page: https://html.bosconvertpro.com/collection/stacking-cards-parallax
- Full-page preview: https://html.bosconvertpro.com/collection/stacking-cards-parallax/full
- Live demo: https://html.bosconvertpro.com/demos/stacking-cards-parallax/index.html
- Markdown mirror: https://html.bosconvertpro.com/collection/stacking-cards-parallax/index.md
- License: https://html.bosconvertpro.com/terms

## How to use
1. Open https://html.bosconvertpro.com/collection/stacking-cards-parallax/full to preview the animation in full screen.
2. Copy index.html, styles.css, and script.js from the code tabs on https://html.bosconvertpro.com/collection/stacking-cards-parallax.
3. Paste the files into your project and adjust timing, easing, and content as needed.

## FAQ
### What is Stacking Cards Parallax?

Stacking Cards Parallax is a scroll UI animation from collections.html. Scroll-stacked cards with parallax and subtle rotation on the previous layer — cinematic storytelling sections.

### What is Stacking Cards Parallax built with?

Stacking Cards Parallax is built with HTML, CSS, JavaScript, and GSAP. The source for every file is shown on the animation page and can be copied straight into your project.

### How do I use Stacking Cards Parallax in my project?

Open the animation page (https://html.bosconvertpro.com/collection/stacking-cards-parallax), preview it live, then copy index.html, styles.css, and script.js from the code tabs. Paste the files into your project and adjust timing, easing, and content as needed. A standalone demo runs at https://html.bosconvertpro.com/demos/stacking-cards-parallax/index.html.

### Is Stacking Cards Parallax free to use?

Yes. The Stacking Cards Parallax demo code may be used in personal and commercial projects. You may not resell or redistribute the collection itself as a competing template pack. Full terms: https://html.bosconvertpro.com/terms.

## Source — index.html
````html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Stacking Cards Parallax</title>
    <link rel="preconnect" href="https://images.unsplash.com" />
    <link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/lenis@1.2.3/dist/lenis.css"
    />
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    
    <section class="section-resource">
      <div class="stacking-cards__collection">
        <div class="stacking-cards__list">
          <div data-stacking-cards-item class="stacking-cards__item is--green">
            <h1 class="stacking-cards__item-h">
              <span class="stacking-card__heading-faded">obsidian</span><br />forged in silence
            </h1>
            <img
              src="https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?auto=format&fit=crop&w=900&q=85"
              loading="lazy"
              data-stacking-cards-img
              alt="Abstract fluid art in deep tones"
              class="stacking-cards__item-img"
            />
            <div class="stacking-cards__item-top">
              <span class="stacking-card__top-span">Materials</span>
              <span class="stacking-card__top-span">01 / 05</span>
            </div>
          </div>

          <div data-stacking-cards-item class="stacking-cards__item is--purple">
            <h1 class="stacking-cards__item-h">
              <span class="stacking-card__heading-faded">terracotta</span><br />earth held close
            </h1>
            <img
              src="https://images.unsplash.com/photo-1610701596007-11502861dcfa?auto=format&fit=crop&w=900&q=85"
              loading="lazy"
              data-stacking-cards-img
              alt="Handmade ceramic vessels"
              class="stacking-cards__item-img"
            />
            <div class="stacking-cards__item-top">
              <span class="stacking-card__top-span">Materials</span>
              <span class="stacking-card__top-span">02 / 05</span>
            </div>
          </div>

          <div data-stacking-cards-item class="stacking-cards__item is--blue">
            <h1 class="stacking-cards__item-h">
              <span class="stacking-card__heading-faded">indigo</span><br />depth before dawn
            </h1>
            <img
              src="https://images.unsplash.com/photo-1550684848-fac1c5b4e853?auto=format&fit=crop&w=900&q=85"
              loading="lazy"
              data-stacking-cards-img
              alt="Deep blue abstract texture"
              class="stacking-cards__item-img"
            />
            <div class="stacking-cards__item-top">
              <span class="stacking-card__top-span">Materials</span>
              <span class="stacking-card__top-span">03 / 05</span>
            </div>
          </div>

          <div data-stacking-cards-item class="stacking-cards__item is--brown">
            <h1 class="stacking-cards__item-h">
              <span class="stacking-card__heading-faded">sagewood</span><br />growth without noise
            </h1>
            <img
              src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?auto=format&fit=crop&w=900&q=85"
              loading="lazy"
              data-stacking-cards-img
              alt="Mountain landscape in soft light"
              class="stacking-cards__item-img"
            />
            <div class="stacking-cards__item-top">
              <span class="stacking-card__top-span">Materials</span>
              <span class="stacking-card__top-span">04 / 05</span>
            </div>
          </div>

          <div data-stacking-cards-item class="stacking-cards__item is--red">
            <h1 class="stacking-cards__item-h">
              <span class="stacking-card__heading-faded">champagne</span><br />light made solid
            </h1>
            <img
              src="https://images.unsplash.com/photo-1618005198919-d3d4b5a92ead?auto=format&fit=crop&w=900&q=85"
              loading="lazy"
              data-stacking-cards-img
              alt="Soft abstract color wash"
              class="stacking-cards__item-img"
            />
            <div class="stacking-cards__item-top">
              <span class="stacking-card__top-span">Materials</span>
              <span class="stacking-card__top-span">05 / 05</span>
            </div>
          </div>
        </div>
      </div>
    </section>

    <script src="https://cdn.jsdelivr.net/npm/gsap@3.13.0/dist/gsap.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/gsap@3.13.0/dist/ScrollTrigger.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/lenis@1.2.3/dist/lenis.min.js"></script>
    <script src="script.js"></script>
  </body>
</html>
````

## Source — styles.css
````css
/* ============================================
   Stacking Cards Parallax
   ============================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100%;
  color: #f2efe8;
  background-color: #0c0b10;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  vertical-align: middle;
  max-width: 100%;
  display: inline-block;
  border: 0;
}

/* ---------- Section ---------- */

.section-resource {
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  display: flex;
}

/* ---------- Collection / list ---------- */

.stacking-cards__collection {
  width: 100%;
}

.stacking-cards__list {
  flex-flow: column;
  display: flex;
}

.stacking-cards__item {
  color: #fff;
  border-top-left-radius: 1em;
  border-top-right-radius: 1em;
  flex-flow: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 100vh;
  margin-top: -1em;
  padding-top: 5em;
  padding-bottom: 5em;
  display: flex;
  position: relative;
}

/* Premium solid card tones */
.stacking-cards__item.is--green {
  background-color: #14352c;
}

.stacking-cards__item.is--purple {
  background-color: #3d2a4a;
}

.stacking-cards__item.is--blue {
  background-color: #1a2d4a;
}

.stacking-cards__item.is--brown {
  background-color: #3a2e1f;
}

.stacking-cards__item.is--red {
  background-color: #3a1f24;
}

/* ---------- Heading (exact metrics; system font instead of PP Neue Corp) ---------- */

.stacking-cards__item-h {
  text-align: center;
  text-transform: uppercase;
  margin-top: 0;
  margin-bottom: 0;
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: 8vw;
  font-weight: 700;
  line-height: 0.8;
  letter-spacing: -0.02em;
}

.stacking-card__heading-faded {
  opacity: 0.5;
}

/* ---------- Image (exact metrics) ---------- */

.stacking-cards__item-img {
  aspect-ratio: 1;
  border-radius: 0.75em;
  width: 30vw;
  margin-top: -1vw;
  object-fit: cover;
}

/* ---------- Top labels (exact metrics) ---------- */

.stacking-cards__item-top {
  justify-content: space-between;
  align-items: center;
  display: flex;
  position: absolute;
  top: 2.5em;
  left: 2.5em;
  right: 2.5em;
}

.stacking-card__top-span {
  font-size: 1em;
  font-weight: 500;
}
````

## Source — script.js
````javascript
/**
 * Stacking Cards Parallax
 *
 * Behaviour:
 * - Smooth scrolling via Lenis (synced with ScrollTrigger)
 * - Skip first card
 * - As each later card scrolls from bottom → top of viewport,
 *   move the PREVIOUS card down (yPercent: 50)
 *   and parallax/rotate its image (rotate: -5, yPercent: -25)
 */

gsap.registerPlugin(ScrollTrigger);

let lenis = null;

function initSmoothScroll() {
  if (typeof Lenis === "undefined") return;
  if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;

  lenis = new Lenis({
    duration: 1.2,
    easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
    smoothWheel: true,
    touchMultiplier: 1.15,
  });

  // Keep ScrollTrigger in sync with smoothed scroll position
  lenis.on("scroll", ScrollTrigger.update);

  gsap.ticker.add((time) => {
    lenis.raf(time * 1000);
  });
  gsap.ticker.lagSmoothing(0);
}

function initStackingCardsParallax() {
  const cards = document.querySelectorAll("[data-stacking-cards-item]");

  if (cards.length < 2) return;

  cards.forEach((card, i) => {
    // Skip over the first section
    if (i === 0) return;

    // When current section is in view, target the PREVIOUS one
    const previousCard = cards[i - 1];
    if (!previousCard) return;

    // Find any element inside the previous card
    const previousCardImage = previousCard.querySelector(
      "[data-stacking-cards-img]"
    );

    let tl = gsap.timeline({
      defaults: {
        ease: "none",
        duration: 1,
      },
      scrollTrigger: {
        trigger: card,
        start: "top bottom",
        end: "top top",
        scrub: true,
        invalidateOnRefresh: true,
      },
    });

    tl.fromTo(previousCard, { yPercent: 0 }, { yPercent: 50 }).fromTo(
      previousCardImage,
      { rotate: 0, yPercent: 0 },
      { rotate: -5, yPercent: -25 },
      "<"
    );
  });
}

// Initialize
document.addEventListener("DOMContentLoaded", () => {
  initSmoothScroll();
  initStackingCardsParallax();
});
````
