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

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.

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

              
                <nav role="navigation" id="menu" class="menu">
  <button class="menu-trigger"><span>Menu</span></button>
  <div class="menu-wrapper">
    <ul>
      <li>
        <a href="#">
          <figure class="fa fa-fw fa-home"></figure>
          <span>Home</span>
        </a>
      </li>
      <li>
        <a href="#">
          <figure class="fa fa-fw fa-heart"></figure>
          <span>Favs</span>
        </a>
      </li>
      <li>
        <a href="#">
          <figure class="fa fa-fw fa-folder"></figure>
          <span>Files</span>
        </a>
      </li>
      <li>
        <a href="#">
          <figure class="fa fa-fw fa-tachometer"></figure>
          <span>Stats</span>
        </a>
      </li>
    </ul>
  </div>
  <figure class="menu-morph-shape" data-morph-open="M300-10c0,0,295,164,295,410c0,232-295,410-295,410" data-morph-close="M300-10C300-10,5,154,5,400c0,232,295,410,295,410">
    <svg width="100%" height="100%" viewBox="0 0 600 800" preserveAspectRatio="none">
      <path fill="none" d="M300-10c0,0,0,164,0,410c0,232,0,410,0,410"/>
    </svg>
  </figure>
</nav>
<main role="main">
  <div class="container"></div>
</main>
              
            
!

CSS

              
                @import bourbon
$textColor: white
$textColor2: #afb3b8
$accentColor: #B24E51
$borderColor: #5f656f
$documentBgColor: #2f3238
@import url(https://fonts.googleapis.com/css?family=Raleway:400,600,700)
*:before, *, *:after
	+box-sizing(border-box)
.clearfix
	&:before, &:after
		content: ''
		display: table
	&:after
		clear: both
body
	color: $textColor
	background: $documentBgColor
	font-weight: 400
	font-size: 1em
	font-family: 'Raleway', Arial, sans-serif
figure
	margin: 0
	padding: 0
a
	color: $accentColor
	text-decoration: none
	&:hover, &:focus
		color: $textColor2
		outline: none
.menu
	+position(fixed, 3em null 3em 0)
	width: 300px
	z-index: 100
	overflow: hidden
	+transform(translateX(-150px))
	+transition(transform 0.6s)
	will-change: transform
	.menu-trigger
		background: $documentBgColor
		border: none
		width: 30px
		height: 24px
		padding: 0
		outline: none
		+position(absolute, 3px 70px null null)
		z-index: 2000
		&:before, span, &:after
			background: $borderColor
		span
			+position(absolute, null null null 0)
			width: 100%
			height: 2px
			overflow: hidden
			text-indent: 200%
			+transition(opacity 0.25s)
			will-change: opacity
		&:before, &:after
			content: ''
			+position(absolute, 50% null null 0)
			height: 2px
			width: 100%
			+transform-origin(50% 50%)
			+transition(transform 0.25s)
			will-change: transform
		&:before
			transform: translateY(-10px)
		&:after
			transform: translateY(10px)
	.menu-wrapper
		width: calc(100% + 25px)
		padding: 0 140px 2em 0
		overflow-y: auto
		height: 100%
		position: relative
		z-index: 100
		ul
			list-style: none
			padding: 0
			margin: 0
			li
				margin: 0 0 2em 0
				+user-select
				+transform(translateX(-150px))
				+transition(transform 0.6s)
				will-change: transform
				&:first-child
					+transition-delay(0.3s)
				&:nth-child(2)
					+transition-delay(0.2s)
				&:nth-child(3)
					+transition-delay(0.1s)
				a
					display: block
					outline: none
					text-align: center
					.fa
						font-size: 2.5em
						display: block
						margin: 0 auto
						color: $borderColor
					span
						font:
							weight: bold
							size: 0.75em
							family: Helvetica, Arial, sans-serif
	.menu-morph-shape
		+position(absolute, 0 0 null null)
		width: 240px
		height: 100%
		svg path
			stroke: $borderColor
			stroke-width: 5px
	&.anim .menu-wrapper ul li
		+transform(translateX(0))
	&.open
		+transform(translateX(0))
		.menu-trigger
			span
				opacity: 0
			&:before
				+transform(rotate3d(0, 0, 1, 45deg))
			&:after
				+transform(rotate3d(0, 0, 1, -45deg))
              
            
!

JS

              
                /*!
 * classie - class helper functions
 * from bonzo https://github.com/ded/bonzo
 * 
 * classie.has( elem, 'my-class' ) -> true/false
 * classie.add( elem, 'my-new-class' )
 * classie.remove( elem, 'my-unwanted-class' )
 * classie.toggle( elem, 'my-class' )
 */

/*jshint browser: true, strict: true, undef: true */
/*global define: false */

( function( window ) {

'use strict';

// class helper functions from bonzo https://github.com/ded/bonzo

function classReg( className ) {
  return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
}

// classList support for class management
// altho to be fair, the api sucks because it won't accept multiple classes at once
var hasClass, addClass, removeClass;

if ( 'classList' in document.documentElement ) {
  hasClass = function( elem, c ) {
    return elem.classList.contains( c );
  };
  addClass = function( elem, c ) {
    elem.classList.add( c );
  };
  removeClass = function( elem, c ) {
    elem.classList.remove( c );
  };
}
else {
  hasClass = function( elem, c ) {
    return classReg( c ).test( elem.className );
  };
  addClass = function( elem, c ) {
    if ( !hasClass( elem, c ) ) {
      elem.className = elem.className + ' ' + c;
    }
  };
  removeClass = function( elem, c ) {
    elem.className = elem.className.replace( classReg( c ), ' ' );
  };
}

function toggleClass( elem, c ) {
  var fn = hasClass( elem, c ) ? removeClass : addClass;
  fn( elem, c );
}

var classie = {
  // full names
  hasClass: hasClass,
  addClass: addClass,
  removeClass: removeClass,
  toggleClass: toggleClass,
  // short names
  has: hasClass,
  add: addClass,
  remove: removeClass,
  toggle: toggleClass
};

// transport
if ( typeof define === 'function' && define.amd ) {
  // AMD
  define( classie );
} else {
  // browser global
  window.classie = classie;
}

})( window );

(function() {

	function SVGMenu( el, options ) {
		this.el = el;
		this.init();
	}

	SVGMenu.prototype.init = function() {
		this.trigger = this.el.querySelector( 'button.menu-trigger' );
		this.shapeEl = this.el.querySelector( 'figure.menu-morph-shape' );

		var s = Snap( this.shapeEl.querySelector( 'svg' ) );
		this.pathEl = s.select( 'path' );
		this.paths = {
			reset : this.pathEl.attr( 'd' ),
			open : this.shapeEl.getAttribute( 'data-morph-open' ),
			close : this.shapeEl.getAttribute( 'data-morph-close' )
		};

		this.isOpen = false;

		this.initEvents();
	};

	SVGMenu.prototype.initEvents = function() {
		this.trigger.addEventListener( 'click', this.toggle.bind(this) );
	};

	SVGMenu.prototype.toggle = function() {
		var self = this;

		if( this.isOpen ) {
			classie.remove( self.el, 'anim' );
			setTimeout( function() { classie.remove( self.el, 'open' );	}, 250 );
		}
		else {
			classie.add( self.el, 'anim' );
			setTimeout( function() { classie.add( self.el, 'open' );	}, 250 );
		}
		this.pathEl.stop().animate( { 'path' : this.isOpen ? this.paths.close : this.paths.open }, 350, mina.easeout, function() {
			self.pathEl.stop().animate( { 'path' : self.paths.reset }, 800, mina.elastic );
		} );
		
		this.isOpen = !this.isOpen;
	};

	new SVGMenu( document.getElementById( 'menu' ) );

})();
              
            
!
999px

Console