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 id="container">   
<div class="description panel blue">
    <div><h1>Layered pinning from bottom</h1>
      <p>A simple example where overlapping panels reveal from the bottom.</p>
      <div class="scroll-down">Scroll down<div class="arrow"></div></div>
    </div>
  </div>

<div id="sections">
  <section class="pane red">
    <div>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Varius vel pharetra vel turpis. Fringilla urna porttitor rhoncus dolor. At urna condimentum mattis pellentesque id nibh tortor id aliquet. Sit amet nisl suscipit adipiscing bibendum est ultricies. In hac habitasse platea dictumst vestibulum rhoncus est pellentesque elit. Suspendisse potenti nullam ac tortor vitae. Ac placerat vestibulum lectus mauris ultrices eros in cursus turpis. Auctor eu augue ut lectus arcu bibendum. Mattis ullamcorper velit sed ullamcorper morbi tincidunt ornare massa eget.

Netus et malesuada fames ac turpis egestas integer. Tempus imperdiet nulla malesuada pellentesque elit eget. Viverra mauris in aliquam sem fringilla ut. Volutpat sed cras ornare arcu dui vivamus arcu. Sit amet consectetur adipiscing elit ut aliquam. Diam vel quam elementum pulvinar etiam non. Vulputate odio ut enim blandit volutpat maecenas. Quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Vel turpis nunc eget lorem dolor. Pharetra et ultrices neque ornare aenean. Id eu nisl nunc mi ipsum faucibus vitae aliquet. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Et tortor consequat id porta nibh venenatis cras sed. Tortor pretium viverra suspendisse potenti nullam. Aliquet nec ullamcorper sit amet risus nullam. Eget mauris pharetra et ultrices neque ornare. Cursus sit amet dictum sit. Morbi leo urna molestie at elementum eu.
    </div>
  </section>
<div class="nav-bar">
      <a href="">test1</a>
      <a href="">test2</a>
      <a href="">test3</a>
      <a href="">test4</a>
</div>
  <section class="pane orange">
    blah
  </section>
  <section class="pane purple">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Varius vel pharetra vel turpis. Fringilla urna porttitor rhoncus dolor. At urna condimentum mattis pellentesque id nibh tortor id aliquet. Sit amet nisl suscipit adipiscing bibendum est ultricies. In hac habitasse platea dictumst vestibulum rhoncus est pellentesque elit. Suspendisse potenti nullam ac tortor vitae. Ac placerat vestibulum lectus mauris ultrices eros in cursus turpis. Auctor eu augue ut lectus arcu bibendum. Mattis ullamcorper velit sed ullamcorper morbi tincidunt ornare massa eget.

Netus et malesuada fames ac turpis egestas integer. Tempus imperdiet nulla malesuada pellentesque elit eget. Viverra mauris in aliquam sem fringilla ut. Volutpat sed cras ornare arcu dui vivamus arcu. Sit amet consectetur adipiscing elit ut aliquam. Diam vel quam elementum pulvinar etiam non. Vulputate odio ut enim blandit volutpat maecenas. Quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis. Vel turpis nunc eget lorem dolor. Pharetra et ultrices neque ornare aenean. Id eu nisl nunc mi ipsum faucibus vitae aliquet. Pulvinar etiam non quam lacus suspendisse faucibus interdum. Et tortor consequat id porta nibh venenatis cras sed. Tortor pretium viverra suspendisse potenti nullam. Aliquet nec ullamcorper sit amet risus nullam. Eget mauris pharetra et ultrices neque ornare. Cursus sit amet dictum sit. Morbi leo urna molestie at elementum eu.
  </section>
 </div>
</div>
<div id="end"></div>

              
            
!

CSS

              
                html,
body {
  margin: 0;
  -webkit-overflow-scrolling: touch;
  overflow-scrolling: touch;
  font-family: 'Nunito Sans', sans-serif;
}

#container {
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
}

.panel {
  position: absolute;
  will-change: transform;
}

.blue{
  height: 100vh;
}

.red, .orange, .purple{
  height: 100vh;
}

.nav-bar{
  background:  rgba(255, 255, 255, 0.5);
    z-index: 2;
    text-align: center;
    width: 100%;
    height: 70px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    top: 0;
    position: sticky;
}
              
            
!

JS

              
                gsap.registerPlugin(ScrollTrigger);

gsap.to(".panel:not(:last-child)", {
  yPercent: -100, 
  ease: "none",
  stagger: 0.5,
  scrollTrigger: {
    trigger: "#container",
    start: "top top",
    end: "+=200%",
    scrub: true,
    pin: true,
  }
});


gsap.set(".panel", {zIndex: (i, target, targets) => targets.length - i});



// gsap.to('.nav-bar', {
//   scrollTrigger: {
//       trigger: ".nav-bar",
//       scrub: true,
//       pin: true,
//       start: "top 0%",
//       endTrigger: "#end",
//       end: "bottom top",
//       pinType: "fixed",
//       markers: true,
//       pinReparent: true,
//       pinSpacing: false,
//   }
// });

              
            
!
999px

Console