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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

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.

HTML

            
              

<div class="wrapper">
<header class="header" role="banner">
  <div class="header-main">
    <h1>The Flyout</h1>
  </div>
</header>

  <div class="overlay"></div>
  <aside class="flyout">
    <div class="flyout-header clearfix"><h4>Heading!</h4><span class="flyout-close flyout-toggle">x</span></div>
    <div class="flyout-body">
      <p>To make this scrollable, in older browsers, you have to add <code>overflow-y: auto;</code> to the flyout element.  Kinda sucks because the header scrolls too.  In newer browsers you can use <code>display: flex; flex-direction: column;</code> to the flyout and apply <code>overflow-y: auto</code> to the flyout body so it only shows the scrollbar as needed.</p>
      <p>Can also change <code>position: absolute</code> to <code>position: fixed</code> but haven't tested this thoroughly yet.
      </p>
      
      <p>More text to make this longer and scrollable.
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Expedita voluptatibus sunt laborum aperiam dolorum numquam officia nam provident dicta aliquid placeat voluptates ratione nesciunt laudantium quam ut a. Hic nisi. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dignissimos nulla omnis facere sint quidem fugit quia labore ab unde officiis consequatur tenetur nemo aliquid ea sunt quis blanditiis magnam harum! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nulla architecto libero distinctio dolores necessitatibus obcaecati pariatur cupiditate eaque unde modi ipsum quidem perferendis nam impedit laboriosam inventore debitis qui soluta!</p>
    </div>
  </aside>
  <div class="content">
    <section class="main" id="main">
      <p>Flyout panel. Great for forms, searches, and other out-of-context items. Transitions used on transform(translate3d), based on these <a href="http://coding.smashingmagazine.com/2013/01/15/off-canvas-navigation-for-responsive-website/">two</a> <a href="https://www.html5rocks.com/en/tutorials/speed/high-performance-animations/">articles</a>. I got the idea of using a panel for secondary information from <a href="https://medium.com/design-ux/bc190d62eff5">this article</a>.</p>
         <button class="btn flyout-toggle">Click to Toggle</button>
      
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illo inventore distinctio animi a debitis aspernatur facere aut dolores quaerat reprehenderit aperiam fuga temporibus quae nostrum hic vitae consequuntur error et!Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rerum eaque maxime illum iure unde perferendis delectus temporibus deleniti eos sapiente numquam necessitatibus in quod voluptatibus nesciunt facilis assumenda! Explicabo soluta.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perspiciatis deleniti facilis dolore incidunt quaerat optio recusandae commodi pariatur cupiditate ex ab mollitia maiores sapiente sint expedita vel laborum nam dolores.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi cupiditate sit cumque possimus maxime sunt recusandae distinctio numquam illum iure dolorem voluptatibus aliquid quae? Voluptatibus aperiam deleniti a quas nobis!Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sapiente quibusdam necessitatibus! Quisquam pariatur aut est omnis harum eum et quas totam fuga dicta fugiat amet impedit atque culpa sint enim.</p>
   
     

    </section>

  </div>

















            
          
!

CSS

            
              $background-color: white;
$flyout-background: white;
$flyout-header-color: #452632;
$nav-link-color: white;
$header-color: #E2F7CE;
$base-text-color: #333;
$breakpoint: 50em;
$transition-duration: .2s;
$bar-height: .2em;
$bar-width: 1em;

@mixin transition($item) {
    -webkit-transition: $item 0.2s ease-in-out;  
    -moz-transition: $item 0.2s ease-in-out;
    -ms-transition: $item 0.2s ease-in-out;
    -o-transition: $item 0.2s ease-in-out;
    transition: $item 0.2s ease-in-out;
}

.clearfix:after {    
    content: "";
    clear: both;
    display: table;   
}







// General layout
* {
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}
body {
  font-family: "Open Sans", sans-serif;
  margin: 0;
}

.wrapper {
    background: $background-color;
    position: relative;
    overflow: hidden;
    width: 100%;
    min-height: 100%;
}

.content {
  padding: 2em;
}

.header {
  background-color: $header-color;
  height: auto;
  padding: .5em;
  h1 {
    display: inline-block;
    font-size: 1.6em;
    margin: 0;
    padding: 0 .5em;
  }
}

li {
  list-style-type: none;
}

.col-50 {
  padding: 1em;
  width: 100%;
  @media (min-width: $breakpoint){
    float: left;
    padding: 1em;
    width: 50%;
  }
}

.overlay {
  background-color: rgba(0, 0, 0, .5);
  position: absolute;
  display: none;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  //@include transition(opacity);
  transition: opacity .2s ease-in-out 1s;
  &.active {
    opacity: 1;
    display: block;
  }
}

.flyout {
  background-color: $flyout-background;
  bottom: 0;
  height: 100%;
  max-width: 280px;
  overflow-y: auto;
  position: fixed;
  right: 0;
  top: 0;
  transform: translate3d(100%, 0, 0);
  width: 80%; 
  @include transition(transform);
  //display: flex; //can use if newer browser
  //flex-direction: column; //can use if newer browser
  &.active {
    transform: translate3d(0, 0, 0);
  }
}

.flyout-header {
  background-color: $flyout-header-color;
  color: white;
  padding: 1em;
  h4 {
    display: inline-block;
    margin: 0;
  }
}

.flyout-body {
  overflow-y: auto; //use in conjunction with display:flex on .flyout
  padding: 1em;
  flex: 0 1 0;
 
}

.flyout-close {
  cursor: pointer;
  float: right;
}

.btn {
  background-color: $flyout-header-color;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2em;
  padding: .5em;
}
            
          
!

JS

            
               $(document).ready(function() {
  var $flyout = $('.flyout'),
  $overlay = $('.overlay'),
  $flyoutToggle = $('.flyout-toggle');
 
  $flyoutToggle.bind("click keypress", function(e) {
    e.preventDefault();
    $flyout.toggleClass('active');
    $overlay.toggleClass('active');
  });
   
  $overlay.bind("click keypress", function(e) {
  e.preventDefault();
    $flyout.toggleClass('active');
    $overlay.toggleClass('active');
  });
 });
            
          
!
999px

Console