css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <header id="hd" class="static-head ">
  <div class="head-content">
    <div class="top-menu-left">
      <i class="material-icons md-92">&#xE8B6;</i>
    </div>
    <div class="logo-container">
      <div class="logo">Peter</div>
    </div>
    <div class="top-menu-right">
      <i class="material-icons md-92">&#xE87D;</i>
    </div>
  </div>
</header>

<div class="outer-container">

  <div class="container cf">
    <nav>
      <ul>
        <li>
          <a href="position-example.html">Home</a>
        </li>
        <li>
          <a href="position-example.html">Hours</a>
        </li>
        <li>
          <a href="position-example.html">Directions</a>
        </li>
        <li>
          <a href="position-example.html">Contact</a>
        </li>
      </ul>
    </nav>

    <section>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas odio, vitae scelerisque enim ligula venenatis dolor. 
    </section>

    <section>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas odio, vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Mauris ante ligula, facilisis sed ornare eu, lobortis in odio. Praesent convallis urna a lacus interdum ut hendrerit risus congue. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta. Cras ac leo purus. Mauris quis diam velit.
    </section>
    <section>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas odio, vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Mauris ante ligula, facilisis sed ornare eu, lobortis in odio. Praesent convallis urna a lacus interdum ut hendrerit risus congue. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta. Cras ac leo purus. Mauris quis diam velit.
    </section>
    
      <section>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas odio, vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Mauris ante ligula, facilisis sed ornare eu, lobortis in odio. Praesent convallis urna a lacus interdum ut hendrerit risus congue. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta. Cras ac leo purus. Mauris quis diam velit.
    </section>
    
      <section>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas odio, vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Mauris ante ligula, facilisis sed ornare eu, lobortis in odio. Praesent convallis urna a lacus interdum ut hendrerit risus congue. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta. Cras ac leo purus. Mauris quis diam velit.
    </section>
    
      <section>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas odio, vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Mauris ante ligula, facilisis sed ornare eu, lobortis in odio. Praesent convallis urna a lacus interdum ut hendrerit risus congue. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta. Cras ac leo purus. Mauris quis diam velit.
    </section>

    <footer>
      <div class="foot-content">
        &copy; Peter Dillon 2016
      </div>
    </footer>

  </div>

</div>
            
          
!
            
              $lt: #ECECEA;
$main: #444;
$main-2: #444;
$dark: #444;


//-------  REM-PX Mixin -------
@function strip-unit($num) {
  @return $num / ($num * 0 + 1);
}
// this is for IE9 prototype only.
// We use px measurements currently in CMS system.
@mixin rem-fallback($property, $values...) {
  $max: length($values);
  $pxValues: '';
  $remValues: '';
  @for $i from 1 through $max {
    $value: strip-unit(nth($values, $i));
    $pxValues: #{$pxValues + $value*16}px;

    @if $i < $max {
      $pxValues: #{$pxValues + " "};
    }
  } 
  @for $i from 1 through $max {
    $value: strip-unit(nth($values, $i));
    $remValues: #{$remValues + $value}rem;

    @if $i < $max {
      $remValues: #{$remValues + " "};
    }
  } 
  #{$property}: $pxValues; 
  #{$property}: $remValues; 
}
//----- END REM-PX Mixin ------

body {
  background: $lt;
  font-family: arial;
  font-size: 1.5rem;
  color: $lt;
  margin: 4rem 0;
}
.outer-container {
  @include rem-fallback(max-width, 75);
  width: 90%;
  margin: 11rem auto;
  box-shadow: 0 6px 12px #ababab;
}
.container {
  background: #fff;
  color: #666;
}

.material-icons.md-92 {
  @include rem-fallback(font-size, 5); 
}
.head-content {
  & {
    position: relative;
  }
  .top-menu-left {
    @include rem-fallback(margin-top, .5); 
    float: left;
    width: 15%;
  }
  .top-menu-right {
    @include rem-fallback(margin-top, .5); 
    float: right;
    width: 15%;
    text-align: right;
  }
  .logo-container {
    & {
      float: left;
      width: 70%;
      padding-left: 10px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .logo {
      margin: 0 auto;
      @include rem-fallback(font-size, 3);
      @include rem-fallback(margin-top, 1.5);
      text-align: center;
    }
  }
}

nav {
  @media (max-width:700px) {
    width: 100%;
  }
  margin-bottom: 2rem;
  background: #eee;
  float: left;
  @include rem-fallback(width, 15);
  @include rem-fallback(padding, .5);
  li {
    a { 
      padding: 10px;
      display: block;
      color: #444;
      text-decoration: none;
          &:hover {
            background-color: #ccc;
          }
    }
  }
}
section {
  padding: 1rem;
  @include rem-fallback(margin-left, 15);
  @media (max-width:700px) {
    width: 100%;
    margin-left: 0;
  }
}
footer, header {
  background: $dark;
  position: fixed;
  width: 100%;
  margin: 0 auto;
  @include rem-fallback(padding, 1);

  .foot-content, .head-content {
    width: 100%;
    @include rem-fallback(max-width, 75);
    margin: 0 auto;
    color: $lt;
  }
}

footer {
  @include rem-fallback(height, 4);
  @include rem-fallback(font-size, 1);
  @include rem-fallback(padding, 1);
  will-change: bottom;
  bottom: 0;
  left: 0;

}
header {
  @include rem-fallback(height, 8);
  transition: transform .5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  top: 0;
  will-change: transform;
}

//------------------------
// Animate header --------
.moveHeaderUp   { transform: translateY(-9rem); }
.moveHeaderDown { transform: translateY(0);      }

            
          
!
            
              // Hide Header on on scroll-down, reveal on scroll-up
var didScroll;
var lastScrollTop = 0;
var delta = 5;
var navbar = $('header');
var navbarHeight = $('header').outerHeight() - 100;
var jhd = document.querySelector('header');

// http://ejohn.org/blog/learning-from-twitter/
$(window).scroll(function(event){
  didScroll = true;
});

setInterval(function() {
  if (didScroll) {
    hasScrolled();
    didScroll = false;
  }
}, 250);
// --------------------
// Check for IE versions
// function isIE () {
//   var myNav = navigator.userAgent.toLowerCase();
//   return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
// }
// --------------------
function hasScrolled() {
  var st = $(this).scrollTop();
  // Make sure they scroll more than delta
  if(Math.abs(lastScrollTop - st) <= delta)
    return;

  if (st > lastScrollTop && st > navbarHeight) {
    // When scrolling down
    if (Modernizr.csstransitions) {
      $('header').removeClass('moveHeaderDown').addClass('moveHeaderUp');
    } 
    else { // IE9 fallback
      $('header').animate({ top: -200 }, 500);
    }
  }
  else {
    // When scrolling up
    if(st + $(window).height() < $(document).height()) {
      if (Modernizr.csstransitions) {
        $('header').removeClass('moveHeaderUp').addClass('moveHeaderDown');
      } 
      else { // IE 9 fallback
        $('header').animate({ top: 0 }, 500);
      }
    }
  }
  didScroll = false;
  lastScrollTop = st;
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console