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.

            
              <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>

            
          
!
            
              $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%;
  }
}
            
          
!
            
              
/* Click events */
 $(function() {
   $(".button-open").on("click", function(e) {
     $(".open-button").toggleClass("open");
     $(".button-open").toggleClass("open");
     $('.slider').toggleClass('open');
   });
 });
            
          
!
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