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="wrapper">
<div class="slideItWrapper">
  <a href="#modal" class="slideIt">
    <span class="open">open</span>
    <span class="close">close</span>
  </a>
</div>
<section>
  <h2>Hello World!</h2>
  <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem.</p>
</section>
<aside id="pageslide">
<div id="modal">
  <h3>Menu!</h3>
  <ul>
    <li><a href="">Link</a></li>
    <li><a href="">Link</a></li>
    <li><a href="">Link</a></li>
    <li><a href="">Link</a></li>
    <li><a href="">Link</a></li>
  </ul>
  <a class="close" href="#">Close</a>
</div>
</aside>
</div>
              
            
!

CSS

              
                @import "compass/css3";

/* STYLES */
body{
  font-family:"Helvetica Neue", Helvetica, sans-serif;
  font-weight:200;
  line-height:1.5;
  letter-spacing:1px;
  font-size:16px;
}
h2{
  font-weight:200;
}

.slideItWrapper{
  position:relative;
}
.slideIt{
  left:8px;
  color:white;
  font-weight:bold;
  text-decoration:none;
  background-color:#7E64BF;
  display:block;
  width:30px;
  height:30px;
  border-radius:40px;
  position:relative;
 span{
    font-size:20px;
    left:6px;
    top:-3px;
    position:absolute;
    text-align:center;
    text-indent:-9999px;
    display:block;
    height:100%;
    width:100%;
    transition: all 1s ease;
    -webkit-transition: all 1s ease;
    height: 100%;
    left: 0;
    overflow: hidden;
    background-image: url('http://purplerockscissors.com/wp-content/themes/prpl/images/casestudies/bg-controls.png');
    background-size: 150%;
    background-position:4px 7px;
    &.open{
      background-position:4px 7px;
      opacity:1;
      -webkit-transform: scale(1,1);
      transform: scale(1,1);
    }
    &.close{
      background-position:-19px 7px;
      opacity:0;
      -webkit-transform: scale(0,0);
      transform: scale(0,0);
    }
  }
  &.active .close{
    opacity:1;
    -webkit-transform: scale(1,1);
    transform: scale(1,1);
  }
  &.active .open{
    opacity:0;
    -webkit-transform: scale(0,0);
    transform: scale(0,0);
  }
  &:before{
    content:'';
    position:absolute;
    display:block;
    width: 0;
	  height: 0;
    left:-13px;
    top:10px;
	  border-top: 5px solid transparent;
	  border-right: 10px solid #7E64BF;
	  border-bottom: 5px solid transparent;
    
  }
  &:hover:before {
    left:-9px;
    transition: all 0.5s ease;
    -webkit-transition: all 0.5s ease;
  }
}

section{
  width:500px;
  margin:0 auto;
}

/* REQUIRED */
#pageslide {
  /* These styles MUST be included. Do not change. */
  display: none;
  position: absolute;
  position: fixed;
  top: 0;
  height: 100%;
  z-index: 999999;
  /* Specify the width of your pageslide here */
  width: 240px;
    
  /* styles */
  background: #7E64BF;
  left: -240px;
  text-shadow: 0 1px 1px rgba(0,0,0,0.1);
  
 h3{
  font-size: 1.8em;
  margin:0;
  padding: 20px;
  font-weight: 300;
  color: #fff;
  }
 ul{
  list-style: none;
  padding:0;
  margin:0;
  }
 li a{
  display: block;
  color: #fff;
  font-size: 1.1em;
  line-height: 3.5;
  padding: 0 20px;
  cursor: pointer;
  border-bottom: 1px solid #594786;
  text-decoration:none;
   &:hover{
    background: #6E58A6;
    }
  }
}
              
            
!

JS

              
                $(document).ready(function() {

  var slideWidth = $('#pageslide').outerWidth(); //grab width of the sliding menu so that this can be controlled in the css only

  $('.slideIt, #pageslide a.close').on("click", function(){  //click function
    $('.slideIt').toggleClass('active'); //toggle the active close vs open icon
    
    if($('#pageslide').is(':visible')) {  //if visible then hide it 
      $('#pageslide').animate({
        left: '-'+slideWidth
      }, 400, function(){
        $('#pageslide').hide();
      } );
      $('.wrapper').animate({
        marginLeft: '0'
      }, 400 );
      $('.slideIt span').text('☰');
    } 
    else{                                //else show it
      $('#pageslide').show().animate({
        left: '0'
      }, 400 );
      $('.wrapper').animate({
        marginLeft: slideWidth
      }, 400 );
    }
  });

});


              
            
!
999px

Console