Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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="sidebar">
  <a href="#" class="button-open">
    <span href="#" class="open-button">
            <span></span>
            <span></span>
            <span></span>
        </span>
    <span class="hidden">Activity</span> Feed
  </a>
  
  <div class="slider">
    <ul class="activity-feed">
        <li class="activity-feed__item"><a href="#">Item</a></li>
      <li class="activity-feed__item"><a href="#">Item</a></li>
      <li class="activity-feed__item"><a href="#">Item</a></li>
      <li class="activity-feed__item"><a href="#">Item</a></li>
      <li class="activity-feed__item"><a href="#">Item</a></li>
      <li class="activity-feed__item"><a href="#">Item</a></li>
      <li class="activity-feed__item"><a href="#">Item</a></li>
    </ul>
  </div>
</div>

<section class="content">
  <h2>Just a bunch of content to show click events still work - Reduce browser width to see the effects</h2>
  
  <p>
<a href="#">Nullam erat risus, porta at ipsum id, dapibus condimentum urna. Suspendisse sodales elit vitae tincidunt congue. Quisque dictum lobortis fermentum. In porttitor orci nulla, sed laoreet mauris porta faucibus. Curabitur eu faucibus nisi, in porttitor lorem. Ut sollicitudin, quam ac sodales malesuada, nunc urna dapibus dolor, eget mattis velit orci et mauris. Phasellus commodo sed tortor sed vehicula. Sed eget lobortis velit. Donec luctus lacinia tempus.</a></p>
  
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus scelerisque enim in rhoncus porttitor. Proin vitae pharetra dui. Vivamus eget risus ut velit faucibus hendrerit. Aliquam at varius mauris, porta commodo ligula. Proin dolor urna, eleifend ac magna ut, congue maximus est. Duis euismod arcu eget lorem consectetur, nec ornare turpis consequat. Praesent sollicitudin nisl at metus tincidunt, eu tincidunt ipsum lobortis. Vestibulum egestas ut velit quis condimentum. Nunc in placerat quam. Morbi nec ante tortor. Mauris malesuada erat vel orci volutpat, ac rhoncus ipsum scelerisque. Maecenas ornare eget felis a molestie.</p>
  
<p>
In lectus mi, tincidunt non molestie et, ornare et leo. Quisque semper scelerisque sagittis. Aliquam venenatis sit amet nisl sit amet ornare. Integer tempor libero sed condimentum pellentesque. Proin lacus leo, mattis eu porta a, luctus in purus. Nam vitae ligula lacus. Fusce vel enim nisi.</p>

<p>
Proin vitae sodales leo. Nunc rhoncus facilisis molestie. Curabitur suscipit ex eros, in luctus mi congue et. Pellentesque eu iaculis ipsum, sed molestie mauris. Donec mauris neque, egestas id rutrum quis, porta sit amet massa. Sed eu ullamcorper elit. Sed lectus leo, imperdiet sed nulla non, dictum porta mi. Nam aliquet mauris a eros efficitur, ut pulvinar erat lacinia. Vivamus libero tellus, suscipit in enim in, malesuada suscipit ipsum. Sed sit amet lorem mattis, porttitor mauris in, iaculis justo. Sed rutrum risus nec nulla convallis, eget gravida diam elementum. Maecenas luctus justo in orci sagittis suscipit. Nunc blandit vehicula est ac gravida. Proin vehicula ligula vel augue viverra, bibendum hendrerit ligula lacinia.</p>
</section>

              
            
!

CSS

              
                $mobile-width: 767px;
$transition-time: 0.3s;

.sidebar {
  width: 20%;
  float: right;
  overflow: hidden;
  padding-top: 40px;
  position: relative;
  height: 100vh;
  background: white;
  pointer-events: all;
  transition: 0.3s;
  transition-delay: 0.2s;
  
  @media (max-width: 1279px) {
    width: 30%;
  }
  
   @media (max-width: $mobile-width) {
     background: transparent;
     position: absolute;
     right: 0;
     pointer-events: none;
     width: 250px;
  }
}

.button-open {
  background: #CCC;
  display: inline-block;
  color: black;
  width: 100%;
  border: 0;
  text-align: center;
  top: 0;
  outline: 0;
  padding: 12px 20px 12px 45px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: absolute;
  right: 0;
  transition: $transition-time;
  transition-delay: 0.1s;
  pointer-events: none;
  
  @media (max-width: $mobile-width) {
    width: 120px;
    pointer-events: all;
  }
  
  .hidden {
    @media (max-width: $mobile-width) {
      display: none;
    }
  }
  
  &.open {
    @media (max-width: $mobile-width) {
      width: 100%;
      text-align: left;
    }
  }
}

.slider{
  background: white;
  pointer-events: all;
  transition: $transition-time ease-out; 
  
  @media (max-width: $mobile-width) {
      height: 100px;
      width: 250px;
      position:absolute;
      transform: translateX(250px); 
      overflow: scroll;
      height: 100vh;

      &.open{
        transform: translateX(0);
    }
  }
}

.activity-feed {
  list-style-type: none;
  padding: 0;
  margin: 0;
  
  &__item {
    
    a {
      color: green;
      padding: 10px 20px;
      display: block;
      border-bottom: 1px solid #EEE;
      
      &:hover {
        background: #EEE;
      }
    }
  }
}

/* Hamburger Styles */

.open-button {
  width: 15px;
  height: 20px;
  transform: rotate(0deg);
  transition: .5s ease-in-out;
  position: absolute;
  cursor: pointer;
  border-bottom: 0;
  top: 14px;
  left: 15px;
  z-index: 9999;
  border-bottom: 0;

  @media (min-width: 768px) {
    display: none;
  }

  &:hover {
    border-bottom: 0;
  }
}

.open-button span {
  display: block;
  position: absolute;
  height: 2px;
  width: 100%;
  background: black;
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: .25s ease-in-out;
}

.open-button span:nth-child(1) {
  top: 0;
  transform-origin: left center;
}

.open-button span:nth-child(2) {
  top: 5px;
  transform-origin: left center;
}

.open-button span:nth-child(3) {
  top: 10px;
  transform-origin: left center;
}

.open-button.open span:nth-child(1) {
  transform: rotate(45deg);
  top: 0px;
  left: 3px;
}

.open-button.open span:nth-child(2) {
  width: 0;
  opacity: 0;
}

.open-button.open span:nth-child(3) {
  transform: rotate(-45deg);
  top: 11px;
  left: 3px;
}
/* Generic Styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  background: #EEE;
}

a {
   text-decoration: none;
}

p, h2 {
  margin: 0 0 20px;
}

.content {
  padding: 50px;
  width: 80%;
  
   @media (max-width: 1279px) {
    width: 70%;
  }
  
  
  @media (max-width: $mobile-width) {
    width: 100%;
  }
}
              
            
!

JS

              
                
/* Click events */
 $(function() {
   $(".button-open").on("click", function(e) {
     $(".open-button").toggleClass("open");
     $(".button-open").toggleClass("open");
     $('.slider').toggleClass('open');
   });
 });
              
            
!
999px

Console