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

              
                %header
  %p This is the Headroom.js grabbing element.

%main
  %h1 This is the main contents.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus nisi voluptatem ex! Id, consequuntur magnam quia unde ea voluptatibus soluta! Laborum beatae eius, quibusdam odit cum, iure dolorum tempore quo?
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.
  %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad numquam pariatur, laboriosam facere. Veritatis est sint officia quam dolorem perferendis repellendus! Magni sequi ipsum nesciunt, veritatis, impedit commodi est id.

%footer
  %p This is the footer.

              
            
!

CSS

              
                // layout
header {
  position: fixed;
  top: 0; left: 0; right: 0;
}

// for Headroom.js default classes
.headroom {
  transition: all .8s linear;
}
.headroom--unpinned {
  top: -80px;
  opacity: .2;
}
.headroom--pinned {
  transition: all .2s ease-in-out;
}

// base settings
header,
footer {
  background: #000;
  color: #fff;
  padding: 1rem;
}

main {
  margin-top: 4rem;
  padding: 1rem;
}

              
            
!

JS

              
                /*
  Headroom.js: 下スクロールで隠れる Scroll Up Bar | deadwood
  http://www.d-wood.com/blog/2016/05/12_7997.html

  Using Headroom.js from CDN
    https://npmcdn.com/headroom.js
  Using Animate.css from CodePen
    https://github.com/daneden/animate.css/
*/

// grab an element
var myElement = document.querySelector('header');
// construct an instance of Headroom, passing the element
var headroom  = new Headroom(myElement, {
  // vertical offset in px before element is first unpinned
  offset: 80,
  // scroll tolerance in px before state changes
  tolerance: 40,
  // if you need other CSS classes, to apply these options.
  classes: {
    // ex.) replace CSS classes for animate.css
    // initial: 'animated',
    // pinned: 'slideInDown',
    // unpinned: 'slideInUp'
  }
});
// initialise
headroom.init();

              
            
!
999px

Console