cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <div id="SlideMenu">
  <ul class="nav">
    <li><a href="javascript:void(0);">Home</a></li>
    <li><a href="https://twitter.com/GenkiHagata">Twitter</a></li>
    <li><a href="https://gist.github.com/hagata/0c270504e92387e277e5">Gist</a></li>
  </ul>
</div>

<div class="center">
  <h1>Click to open the side menu</h1>
  
<svg id="MenuToggle" onClick="openMenu()" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 318 258.7" enable-background="new 0 0 318 258.7"><path stroke="#fff" stroke-miterlimit="10" d="M62.4 50.8h193.2V79H62.4zM62.4 116.3h193.2v28.2H62.4zM62.4 179.7h193.2v28.2H62.4z"/></svg>
</div>






            
          
!
            
              
/* Important Variables */
$base-curve: cubic-bezier(.17,.67,.57,.86);
$base-transition: all 100ms $base-curve;

//The non-name parts that add the curve and other properties
$base-animation: infinite $base-curve alternate forwards;

/* Mixins */
//a simple size mixin
@mixin size($size){
	height:$size;
	width:$size;
}
 
//Sets the transformation origin, especially useful for scales, and rotations
//e.g.,
//@import origin(50%,50%); //for center origin
@mixin origin($originX, $originY){
	-webkit-transform-origin:$originX $originY;
	transform-origin:$originX $originY;
}

//Uniform X,Y scale
//e.g.,
// @import scale(1.5) //makes the size 150%, remember scale 1 is the "normal" size
@mixin scale($scale){
	-webkit-transform:scaleX($scale) scaleY($scale);
	transform:scaleX($scale) scaleY($scale);
}

/* ====================================== */
/* ======= Sample base transform ======= */
/* ====================================== */
#MenuToggle{
  @include size(48px);
  transition:$base-transition;
  cursor:pointer;
  
  &:hover{
    @include scale(1.1);
    fill:teal;
  }
  
}


/* ====================================== */
/* Keyframe Animation */
/* ====================================== */

#SlideMenu{
  width:240px;
  height:100%;
  position: fixed;
  left:0; top:0;
  background:teal;
  z-index:100;
  opacity:.5;
  transform:translateX(-100%)
}


.slideInFromLeft{
	animation: slideLeft 200ms $base-animation;
	animation-iteration-count: 1;
	
}



/*============================================== */
/* ======  @Keyframe Animation Definition ====== */
/* ============================================= */

/* The Keyframe mixin */
@mixin slide-in-x($origin,$destination){
	0%{
		transform:translateX($origin);
		opacity: 0;
	}
  95%{
    transform:translateX($destination+10px);
    opacity:1
  }
	100%{
		transform:translateX($destination);
		opacity: 1;
	}
}

/* The @keyframe call */
@keyframes slideLeft{
	@include slide-in-x(-200px,-10px);
}	 







/* Page Styling */
body{
  box-sizing:border-box;
  font-family:'Roboto';
  color:#545454;
}
.center{
  width:30em;
  margin:0 auto;
  text-align:center;
}

#SlideMenu ul{
  margin-left:1em;
  padding:1em;
  
  li{
    list-style:none;
    line-height:1.2;
    margin-bottom:1em;
    
  }
  a{
    color:white;
    text-decoration:none;
    font-size:1.2em;
  }

}

            
          
!
            
              
	var menu = document.getElementById("SlideMenu");

	openMenu = function(){
		menu.classList.toggle("slideInFromLeft");

	}

            
          
!
999px
Loading ..................

Console