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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <div class="global-container">
  
<div class="filters">
  
  <ul>
    
  <li><a href="#content1" class="active">Button 1</a></li>
  <li><a href="#content2">Button 2</a></li>
  <li><a href="#content3">Button 3</a></li>
  <li><a href="#content4">Button 4</a></li>
  <li><a href="#content5">Button 5</a></li>
    
  </ul>
  
</div><!-- end filters-->

  <div class="content" id="content1">
    Lorem ipsum dolor sit amet consectetur adipisicing elit. Temporibus vero quos veritatis ea! Saepe voluptatum nesciunt quibusdam sequi voluptatibus vitae, natus ratione velit ea aspernatur et enim ullam hic? Nisi.
  </div>

  <div class="content" id="content2" hidden>
    Lorem ipsum dolor sit amet consectetur adipisicing elit. Similique alias expedita dolore, quasi hic in magnam, excepturi molestias placeat saepe laudantium vel adipisci quam, consectetur omnis. Hic expedita doloribus reiciendis amet necessitatibus dolores corporis quaerat neque nobis. Illo, aliquid! Odit officia libero culpa deserunt modi.
  </div>

  <div class="content" id="content3" hidden>
    Lorem ipsum dolor sit amet consectetur adipisicing elit. Architecto mollitia totam velit quasi, officia explicabo accusamus iure veniam qui in.
  </div>

  <div class="content" id="content4" hidden>
    Lorem ipsum dolor sit amet consectetur adipisicing elit. Autem fugiat, temporibus id aspernatur pariatur sit, cum laborum neque natus est rerum molestias sunt minima modi mollitia recusandae tenetur necessitatibus ducimus voluptas qui ipsum ab explicabo eum. Culpa, ex. Enim ea iure, quam est ipsam reiciendis inventore dignissimos explicabo itaque voluptatum vero, adipisci necessitatibus soluta voluptates quibusdam incidunt praesentium nulla officia quae fugiat harum tempore dolores modi? Veritatis, ad? Earum quisquam perspiciatis odit, ad omnis nobis sint assumenda animi expedita voluptates!
  </div>

  <div class="content" id="content5" hidden>
    Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quo ullam ad itaque fugit consequuntur, quos a hic obcaecati iste ipsum porro sed laborum blanditiis voluptas odit quia aperiam, illo accusamus! Quasi in totam beatae corrupti dolorum dolor repellendus omnis saepe laudantium blanditiis? Reprehenderit harum voluptatem quia quod iure necessitatibus ab, minima voluptates expedita iusto voluptatibus dolor nam nisi ea deserunt quidem, laboriosam explicabo, eos aliquid?
  </div>
  
 
 </div><!-- end global container-->
              
            
!

CSS

              
                .global-container {
  max-width: 600px;
  margin: 2em auto;
}

.content {
  padding: 1em;
}

ul {
  list-style: none;
  display: flex;
  li {
    margin-right: 10px;
    a {
      padding: 1em;
      &.active {
        background: red;
      }
    }
  }
}

[hidden] {
  display: none;
}
              
            
!

JS

              
                var $filters = $(".filters ul");
var $content = $(".content");

$filters.on("click", "a", function(e) {
  e.preventDefault();

  var id = $(this).attr("href");

  $content.filter(":not([hidden])").attr("hidden", true);

  TweenMax.from(id, 10, {autoAlpha: 0});
  $(id).removeAttr("hidden");

  $filters.find(".active").removeClass("active");

  $(this).addClass("active");
});

              
            
!
999px

Console