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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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="header">
  <h1>ScrollMagic - Sticky header</h1>
</div>
<nav class="menu" id="nav">
  <li><a href="">Home</a></li>
  <li><a href="">Somewhere Else</a></li>
  <li><a href="">About</a></li>
  <li><a href="">Team</a></li>
</nav>

<div class="content">
  <h2>Instructions</h2>
  Basically include the ScrollMagic library then paste my JS to your custom JS file (after ScrollMagic).
  
  Then just adjust the triggerElement to reflect your code.
  
  Don't mine the CSS - You don't need it.
</div>

<div class="bottom-section">
   Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet, eos veritatis velit hic nisi odit fugit impedit neque odio animi, aperiam vel nemo recusandae, pariatur non, dolorem nihil consectetur illo!
  
   Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet, eos veritatis velit hic nisi odit fugit impedit neque odio animi, aperiam vel nemo recusandae, pariatur non, dolorem nihil consectetur illo!
  
   Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet, eos veritatis velit hic nisi odit fugit impedit neque odio animi, aperiam vel nemo recusandae, pariatur non, dolorem nihil consectetur illo!
  
   Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet, eos veritatis velit hic nisi odit fugit impedit neque odio animi, aperiam vel nemo recusandae, pariatur non, dolorem nihil consectetur illo!
</div>

<div class="content">
  <h2>Heading of this epic section</h2>
  Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet, eos veritatis velit hic nisi odit fugit impedit neque odio animi, aperiam vel nemo recusandae, pariatur non, dolorem nihil consectetur illo!
</div>

              
            
!

CSS

              
                
* {
  box-sizing: border-box;
}

.header {
  min-height: 85vh;
  text-align: center;
  background-image: url('https://images.unsplash.com/photo-1466837838619-c8f5b8f0c166?dpr=1&auto=format&crop=entropy&fit=crop&w=1500&h=1000&q=80&cs=tinysrgb');
  background-size: cover;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
}

h1 {
  font-size: 48px;
  letter-spacing: 2px;
  font-family: helvetica;
}

nav {
  background: #000;
  overflow: hidden;
  padding: 20px;
  flex-direction: row;
  display: flex;
  justify-content: space-around;
  z-index: 20;
  
  li {
    
    list-style: none;
    margin-right: 30px;
    
    a {
      color: #fff;
      text-decoration: none;
    }
    
  }
  
}

.content {
  min-height: 500px;
  padding: 50px;
}

.bottom-section {
  min-height: 500px;
  background: #fce3a4;
  padding: 100px;
}
              
            
!

JS

              
                //set up ScrollMagic
  var controller = new ScrollMagic.Controller({
      globalSceneOptions: {
          triggerHook: 'onLeave'
      }
  });


  //pin the navigation
  var pin = new ScrollMagic.Scene({
      triggerElement: '#nav',
      //offset: '80px'
  }).setPin('#nav', {pushFollowers: false}).addTo(controller);



              
            
!
999px

Console