cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

            
              <!-- | Header & Navigation Section | -->
<div id="section-header" class="expanded row" style="height:515px;"> <!-- inline height style temporary hotfix -->
  
  <!-- | Hero Header | -->
  <header id="header-hero" class="header-hero">
    <ul class="menu pull-right hide-for-small-only" style="position: fixed; top: 0; right: 0; z-index: 10; padding: 0.75rem;">
      <li><a href="#" class="small button">Call to Action!</a></li>
    </ul>
    <a href="#" class="pull-right hide-for-medium" style="position: fixed; top: 0; right: 0; z-index: 10; padding: 0.75rem;">
      <img src="http://placehold.it/64x42&content=Logo" alt="logo" style="border:1px solid #2199e8">
    </a>
  </header>
  
  <!-- | Sticky Navigation | -->
  <nav data-sticky-container>
    <div class="sticky" data-sticky data-margin-top="0" data-top-anchor="header-hero:bottom" data-btm-anchor="section-content:bottom" data-sticky-on="small">
      
      <!-- | Responsive Menu Toggle | -->
      <div id="responsive-menu-toggle" class="top-bar hide-for-medium">
        <div class="top-bar-title">
          <div class="pull-left" data-responsive-toggle="responsive-menu" data-hide-for="medium">
            <button id="responsive-menu-btn" class="button" data-toggle style="margin-bottom:0;"><i class="fa fa-md fa-bars"></i> Menu</button>
          </div> <!-- /data-responsive-toggle -->
        </div> <!-- /.top-bar-title -->
      </div><!-- /#responsive-menu-toggle -->
      
      <!-- | Responsive Menu | -->
      <div id="responsive-menu" class="multi-bar">
        
        <!-- | Top Bar 1 | -->
        <div class="top-bar hide-for-small-only">
          <div class="top-bar-title">
            <a href="#"><img src="http://placehold.it/126x42&content=Logo" alt="logo" style="border:1px solid #2199e8"></a>
          </div> <!-- /.top-bar-title -->
        </div> <!-- /#top-bar-1 -->
        
        <!-- | Top Bar 2 | -->
        <div id="top-bar-2" class="top-bar">
          <div class="top-bar-title">
          </div> <!-- /.top-bar-title -->
          <div class="top-bar-left">
            <ul class="menu vertical medium-horizontal">
              <li class="active"><a href="#">One</a></li>
              <li><a href="#">Two</a></li>
              <li><a href="#">Three</a></li>
            </ul>
          </div> <!-- /.top-bar-left -->
          <div class="top-bar-right">
            <ul class="menu pull-left">
              <li><a href="#"><i class="fa fa-md fa-facebook"></i></a></li>
              <li><a href="#"><i class="fa fa-md fa-twitter"></i></a></li>
              <li><a href="#"><i class="fa fa-md fa-github"></i></a></li>
              <li><a href="#"><i class="fa fa-md fa-codepen"></i></a></li>
              <li><a href="#"><i class="fa fa-md fa-linkedin"></i></a></li>
            </ul>
            <ul class="menu pull-right pull-left-for-small-only hide-for-medium">
              <li><a href="#" class="tiny button">Call to Action!</a></li>
            </ul>
          </div> <!-- /.top-bar-right -->
        </div> <!-- /#top-bar-2 -->
      </div> <!-- /#responsive-menu -->
    </div> <!-- /.sticky -->
  </nav>
</div> <!-- /#section-header -->

<!-- | Main Content Section | -->
<div id="section-content" class="row column">
  <h3 class="text-center buffer-m-t-64">Creating a sticky Navigation Menu with Top Bar!</h3>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptate est in inventore fugit repudiandae aliquid maxime minus vitae quae quidem? Non saepe harum eaque voluptatem eveniet sapiente, explicabo expedita facere.</p>
  <hr>
  <img src="http://placehold.it/1200x1200&text=content" alt="placeholder1" class="thumbnail">
  <hr>
  <img src="http://placehold.it/1200x1200&text=content" alt="placeholder2" class="thumbnail">
  <hr>
  <img src="http://placehold.it/1200x1200&text=content" alt="placeholder3" class="thumbnail">
</div> <!-- /#section-content -->

<!-- | Footer Section | -->
<div id="section-footer" class="buffer-m-t-64">
  <div class="expanded row">
    <footer class="footer">
      <span class="pull-left">
        <a data-tooltip aria-haspopup="true" class="has-tip top" data-disable-hover="false" tabindex="0" title="Opens in a new tab." href="https://twitter.com/jordbrauer" target="_blank">Jordan Brauer, 2016</a>
      </span>
      <span class="pull-right">

      </span>
      <div class="clearfix"></div>
    </footer>
  </div> <!-- /.expanded row -->
</div> <!-- /#section-footer -->
            
          
!
            
              // Background.
body{background: url(https://developer.cdn.mozilla.net/static/img/blueprint-dark.fd85a7a074ae.png) top left repeat;}

// Data.
[data-sticky]{
  width: 100%;
}

// Margin Buffers.
.buffer-m-b-64{margin-bottom: 64px;}
.buffer-m-t-64{margin-top: 64px;}
.buffer-m-t-32{margin-top: 32px;}

// Floats.
@media screen and (max-width: 430px) {
  .pull-left-for-small-only{
    float: left !important;
  }
}

// Header.
.header-hero{
  padding: 10rem 0;
  background: url(http://placehold.it/2000x500&content=Hero-Image) center center no-repeat;
  background-size: cover;
}

// Multi-bar Top Bar.
.multi-bar{
  box-shadow: 0 4px 8px rgba(0,0,0,0.25);
  .top-bar:not(:last-child){
    background: lighten(#E6E6E6, 3.5%);
  }
}

.top-bar{
  padding: 1.75rem;
  transition: all .2s ease;
}

.is-stuck .top-bar{
  padding: 0.75rem;
  transition: all .2s ease;
}

#responsive-menu-toggle{
  background: lighten(#E6E6E6, 3.5%);
  box-shadow: 0 4px 8px rgba(0,0,0,0.25);
  .top-bar-title{
    width: 100%;
  }
}

// Footer.
.footer{
  margin-top: 64px;
  height: auto;
  padding: 1rem;
  background-color: #e6e6e6;
}
            
          
!
            
              // initialize foundation.
$(document).foundation();

// declare variables.
var $top_bar = $('.top-bar'),
    $menu_btn = $('#responsive-menu-btn');

// top bar sticky shrink class toggle.
$top_bar.on('sticky.zf.stuckto:top', function() {
  var $this = $(this);
  
  $this.addClass('shrink');
}).on('sticky.zf.unstuckfrom:top', function() {
  var $this = $(this);
  
  $this.removeClass('shrink');
})

// top bar responsive menu button context toggle.
$menu_btn.on('click', function(){
  $this = $(this);
  
  $this.toggleClass('alert').promise().done(function()
  {
    if ($this.hasClass('alert')) {
      $this.html('<i class="fa fa-md fa-times"></i> Close');
    } else {
      $this.html('<i class="fa fa-md fa-bars"></i> Menu');
    }
  });
});
            
          
!
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