Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="placeholder">
  <div class="placeholder__wrapper">
    <div class="placeholder__title">
      <p class="placeholder__subtitle">GreenSock</p>
      <h1 class="placeholder__h1">ScrollTrigger</h1>
      <!-- <p class="placeholder__subtitle">and toggleActions</p> -->
    </div>
    <h2>Scroll down</h2>
    <div class="arrow arrow-down">&#8595;</div>
  </div>
</div>
<div id="scroll-wrapper" class="scroll-wrapper">
  <div class="container">
    <ul class="list">
      <li class="list__item">
        <h2>Lorem ipsum dolor sit amet.</h2>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ut molestiae totam amet beatae ad harum? Nobis, dignissimos. Odit quibusdam voluptatem doloribus eum mollitia rerum tenetur possimus corrupti aut excepturi! Cum?</p>
      </li>
      <li class="list__item">
        <h2>Id alias numquam ratione. Sunt?</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad labore at placeat id maxime dolorum nemo praesentium nisi. Dolorum, in iusto. Cum minima sit accusamus. Officia saepe incidunt maxime fugit.</p>
      </li>
      <li class="list__item">
        <h2>Explicabo nemo ipsa quisquam labore?</h2>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Placeat expedita voluptate, quos quasi ipsa illum. Harum eligendi praesentium quae expedita optio unde eum placeat debitis? Dolores placeat quidem nihil odio?</p>
      </li>
      <li class="list__item">
        <h2>Cum sequi fugit aliquam sit.</h2>
        <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Similique doloremque iste illum omnis incidunt fugiat non suscipit eos distinctio voluptatibus. Corporis consequatur numquam ut aut vero, iste maxime magnam. Dolorum.</p>
      </li>
      <li class="list__item">
        <h2>Obcaecati exercitationem quam ut corporis?</h2>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid dolor repellendus debitis at modi laboriosam molestias, accusamus, quas sint eligendi, culpa deleniti voluptatem. Culpa recusandae ex dolorem optio fuga unde.</p>
      </li>
      <li class="list__item">
        <h2>Architecto natus commodi pariatur a.</h2>
        <p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Magni id ipsa amet harum distinctio numquam voluptatem hic vitae modi magnam cupiditate quis, eius, quae facere odit, saepe tempora? Accusamus, reprehenderit!</p>
      </li>
      <li class="list__item">
        <h2>Iusto vel natus sed veniam?</h2>
        <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Quisquam asperiores earum sint nisi commodi quaerat, maxime illum. Nam nihil, laborum perferendis dolorem minus molestias dolor aspernatur esse ex ipsum beatae.</p>
      </li>
      <li class="list__item">
        <h2>Repudiandae velit molestiae ipsum beatae?</h2>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Exercitationem iure iste ab corrupti fugit sint neque quia, culpa minima nisi earum perspiciatis consequatur, amet itaque incidunt repellat impedit, aliquid expedita.</p>
      </li>
      <li class="list__item">
        <h2>Aliquid eligendi cumque ullam libero!</h2>
        <p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Omnis enim dolorem recusandae doloremque illum, eos inventore ullam labore dignissimos. Eum impedit atque quisquam ratione natus suscipit repellendus facere quidem. Officia.</p>
      </li>
      <li class="list__item">
        <h2>Laboriosam voluptatibus numquam facilis suscipit.</h2>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Asperiores, dicta! Voluptatibus repellat, error vitae, provident alias nulla recusandae nihil eum quidem aliquam obcaecati, voluptate expedita autem esse natus possimus minus!</p>
      </li>
    </ul>
  </div>
</div>
</div>
<div class="placeholder">
  <div class="placeholder__wrapper">
    <div class="arrow arrow-up">&#8593;</div>
    <h2>Scroll up </h2>
    <p>Have a nice day! ✌️</p>
  </div>
</div>
              
            
!

CSS

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

body {
  font-family: sans-serif;
  font-size: 20px;
  line-height: 1.4;
  overflow-x: hidden;
}

.container {
  width: 80%;
  margin: 0 auto;
  padding: 0 24px;
}

.placeholder {
  height: 100vh;
  background: indigo;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.placeholder__title {
  margin-bottom: 36px;
}

.placeholder__h1 {
  font-size: 64px;
  margin-bottom: 0;
  margin-top: -12px;
}

.placeholder__subtitle {
  text-align: left;
  margin: 0;
}

.placeholder__wrapper {
  text-align: center;
}

.arrow {
  font-size: 32px;
}

.scroll-wrapper {
  background: #ebebeb;
}

.list {
  list-style-type: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 64px 0;
  margin: 0;
}

.list__item {
  background: #fff;
  border-radius: 8px;
  width: calc(100% / 2 - 12px);
  padding: 0;
  padding: 24px;
  margin-bottom: 32px;
}

.list__item:nth-last-child(-n + 2) {
  margin-bottom: 0;
}

              
            
!

JS

              
                gsap.registerPlugin(ScrollTrigger);

gsap.to(".arrow-down", { y: 10, repeat: -1, yoyo: true });
gsap.to(".arrow-up", { y: -10, repeat: -1, yoyo: true });

const listItems = Array.from(document.getElementsByClassName("list__item"));

listItems.forEach((item, index) => {
  gsap.set(item, { opacity: 0, x: index % 2 ? 100 : -100 });

  gsap.to(item, {
    x: 0,
    opacity: 1,
    scrollTrigger: {
      trigger: item,
      start: "top 90%",
      end: "bottom",
      // toggleActions: "${onEnter} ${onLeave} ${onEnterBack} ${onLeaveBack}"
      // options: play, pause, resume, reset, restart, complete, reverse, and none
      toggleActions: "play reverse play reverse"
      // once: true,
      // markers: true
    }
  });
});

              
            
!
999px

Console