<article id="pinContainer">
      <section id="page01" class="section">
        <h1>Parallax 1</h1>
        <div class="box"></div>
        <div class="box"></div>
      </section>
      <section id="page02" class="section">
        <h1>Parallax 2</h1>
        <div class="box"></div>
      </section>
      <section id="page03" class="section">
        <h1>Parallax 3</h1>
        <div class="box"></div>
        <div class="box"></div>
      </section>
      <section id="page04" class="section">
        <h1>Parallax 4</h1>
        <div class="box"></div>
        <div class="box"></div>
        <div class="box"></div>
      </section>
    </article>
h1 {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    z-index: 10;
    transform: translate(0, -50%);
    font-size: 50px;
    text-align: center;
  }
  #pinContainer {
    overflow: hidden;
    width: 100%;
    height: 100vh !important;
  }
  section {
    position: absolute;
    width: 100%;
    height: 100vh;
  }
  #page01 {
    z-index: -1;
    background: orange;
  }
  #page02 {
    background: pink;
  }
  #page03 {
    background: skyblue;
  }
  #page04 {
    background: grey;
  }
const controller = new ScrollMagic.Controller(); // // 1. ScrollMagic 컨트롤러 생성
      const section = document.querySelectorAll('.section');

      let timeLineMax = new TimelineMax();
      // 2. 움직질 요소와 인터랙션 추가
      section.forEach( (el, boxIndex) => { 
        if (boxIndex > 0) {
          timeLineMax.fromTo(`#${el.id}`, 1, {y: "100%"}, {y: "0%", ease: Linear.easeNone})
        }
      })

      new ScrollMagic.Scene({
          triggerElement: "#pinContainer",
          triggerHook: "onLeave",
          duration: "400%"
        })
        .setPin("#pinContainer")  // 3. 컨텐츠 setPin으로 고정
        .setTween(timeLineMax)
        .addIndicators()
        .addTo(controller);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.8/ScrollMagic.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.8/plugins/debug.addIndicators.min.js
  3. https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.8/plugins/animation.gsap.min.js
  4. https://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js