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

              
                
<nav>
  <button>ONE</button>
  <button>TWO</button>
  <button>THREE</button>
</nav>

<main>

<h1>Just a LINE.</h1>

  <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. <br><br>Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Maecenas nec odio et ante tincidunt tempus. <br><br>Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. <br><br>Sed consequat, leo eget bibendum sodales, augue velit cursus nunc consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, </p>
  
  <img src="https://assets.codepen.io/174563/adrian-korte-76051-unsplash.jpg" />
    <img src="https://assets.codepen.io/174563/adrian-korte-76051-unsplash.jpg" />
    <img src="https://assets.codepen.io/174563/adrian-korte-76051-unsplash.jpg" />
    <img src="https://assets.codepen.io/174563/adrian-korte-76051-unsplash.jpg" />

  <h1>Just a LINE.</h1>

  <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc</p>
  
</main>

              
            
!

CSS

              
                body{
  margin:0;
  width:100%;
  height:3000px;
  background-color:grey;
  font-family:sans-serif;
}
nav{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 28px;
  padding: 10px 20px;
  background-color: green;
  z-index:1;
}
button{
  font-size: 20px;
  font-weight: 600;
  color: #383838;
  padding: 4px 24px;
  margin-right: 10px;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  outline: none;
}
main{
  margin:120px 15% 0 15%;
  
}
img{
  width: 85%;
  margin: 25px 0;
  visibility:hidden;
}
              
            
!

JS

              
                
var actionNav = gsap.to('nav', {y:'-=60', duration:0.5, ease:'power2.in', paused:true});


ScrollTrigger.create({
  trigger: "nav",
  start: "10px top",
  end: 99999,
  onUpdate: ({progress, direction, isActive}) => {
    if (direction == -1) {
      actionNav.reverse()
    } if (direction == 1 ) {
      actionNav.play()
    } else if (direction == 1 && isActive == true) {
      actionNav.play()
    }
  }
});


var actionFade = gsap.utils.toArray("img").forEach(function(elem) {
  
  ScrollTrigger.create({
    trigger: elem,
    start: "top 80%",
    end: "top -100px",

    onEnter: () => gsap.timeline()
    .to(elem, {autoAlpha:1})
    .from(elem, {y:'+=50'},0),

    onEnterBack: () => gsap.timeline()
    .to(elem, {autoAlpha:1, y:0}),

    onLeave: () => gsap.timeline()
    .to(elem, {autoAlpha:0, y:'-=50'}),

    onLeaveBack: () => gsap.timeline()
    .set(elem, {autoAlpha:0, y:0}),

    markers:true
  })
});

              
            
!
999px

Console