JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="menu-wrap">
<nav class="menu">
<div class="icon-list">
<a href="#"><i class="fa fa-fw fa-star-o"></i><span>Favorites</span></a>
<a href="#"><i class="fa fa-fw fa-bell-o"></i><span>Alerts</span></a>
<a href="#"><i class="fa fa-fw fa-envelope-o"></i><span>Messages</span></a>
<a href="#"><i class="fa fa-fw fa-comment-o"></i><span>Comments</span></a>
<a href="#"><i class="fa fa-fw fa-bar-chart-o"></i><span>Analytics</span></a>
<a href="#"><i class="fa fa-fw fa-newspaper-o"></i><span>Reading List</span></a>
</div>
</nav>
<button class="close-button" id="close-button">Close Menu</button>
</div>
<button class="menu-button" id="open-button">Open Menu</button>
<div class="content-wrap">
<div class="content">
<header class="codrops-header">
<div class="codrops-links">
<a class="codrops-icon codrops-icon-prev" href="http://tympanus.net/Development/TabStylesInspiration/"><span>Previous Demo</span></a>
<a class="codrops-icon codrops-icon-drop" href="http://tympanus.net/codrops/?p=20100"><span>Back to the Codrops Article</span></a>
</div>
<h1>Off-Canvas Menu Effects <span>Showing (off-canvas) menus stylishly</span></h1>
<nav class="codrops-demos">
<a href="index.html">Top Side</a>
<a class="current-demo" href="sideslide.html">Side Slide</a>
<a href="cornerbox.html">Corner Box</a>
<a href="cornerbox_nested.html">Nested Corner Box</a>
<a href="topexpand.html">Top Expand</a>
<a href="cornermorph.html">Corner Morph</a>
<a href="elastic.html">Elastic</a>
<a href="bubble.html">Bubble</a>
<a href="wave.html">Wave</a>
</nav>
</header>
<!-- Related demos -->
<section class="related">
<p>If you enjoyed this demo you might also like:</p>
<a href="http://tympanus.net/Development/SidebarTransitions/">
<img...
CSS
@import url(http://fonts.googleapis.com/css?family=Raleway:200,400,700,800);
@font-face {
font-weight: normal;
font-style: normal;
font-family: 'codropsicons';
src:url('../fonts/codropsicons/codropsicons.eot');
src:url('../fonts/codropsicons/codropsicons.eot?#iefix') format('embedded-opentype'),
url('../fonts/codropsicons/codropsicons.woff') format('woff'),
url('../fonts/codropsicons/codropsicons.ttf') format('truetype'),
url('../fonts/codropsicons/codropsicons.svg#codropsicons') format('svg');
}
*, *:after, *:before { -webkit-box-sizing: border-box; box-sizing: border-box; }
.clearfix:before, .clearfix:after { content: ''; display: table; }
.clearfix:after { clear: both; }
body {
background: #b4bad2;
color: #fffce1;
font-weight: 400;
font-size: 1em;
font-family: 'Raleway', Arial, sans-serif;
}
a {
color: #4e4a46;
text-decoration: none;
outline: none;
}
a:hover, a:focus {
color: #c94e50;
outline: none;
}
button:focus {
outline: none;
}
section {
padding: 1em;
text-align: center;
}
/* Header */
.codrops-header {
margin: 0 auto;
padding: 3em 2em;
text-align: center;
}
.codrops-header h1 {
margin: 0 auto;
font-weight: 800;
font-size: 3.75em;
line-height: 1;
}
.codrops-header h1 span {
display: block;
font-size: 50%;
font-weight: 400;
padding-top: 0.325em;
}
.codrops-links {
text-transform: uppercase;
font-weight: 700;
font-size: 0.69em;
line-height: 2.2;
padding: 1.61em 5em;
}
.codrops-links a {
display: inline-block;
padding: 0 1em;
text-decoration: none;
letter-spacing: 1px;
}
.codrops-icon:before {
margin: 0 4px;
text-transform: none;
font-weight: normal;
font-style: normal;
font-variant: normal;
font-family: 'codropsicons';
line-height: 1;
speak: none;
-webkit-font-smoothing: antialiased;
}
.codrops-icon-drop:before {
content: "\e001";
}
.codrops-icon-prev:before {
content: "\e004";
}
/* Demo Buttons Style */
.codrops-demos {
font-size: 1em;
max-width: 1200px;
margin: 3em auto...
JavaScript
/*!
* 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 );
/**
* main.js
* http://www.codrops.com
*
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright...