JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
<h1 class="page_title">Side Menu Animation</h1>
<h4 class="what_to_do">(click the menu icon)</h4>
<div class="side_menu">
<div class="burger_box">
<div class="menu-icon-container">
<a href="#" class="menu-icon js-menu_toggle closed">
<span class="menu-icon_box">
<span class="menu-icon_line menu-icon_line--1"></span>
<span class="menu-icon_line menu-icon_line--2"></span>
<span class="menu-icon_line menu-icon_line--3"></span>
</span>
</a>
</div>
</div>
<div class="container">
<h2 class="menu_title">Menu Title</h2>
<ul class="list_load">
<li class="list_item"><a href="#">List Item 01</a></li>
<li class="list_item"><a href="#">List Item 02</a></li>
<li class="list_item"><a href="#">List Item 03</a></li>
<li class="list_item"><a href="#">List Item 04</a></li>
<li class="list_item"><a href="#">List Item 05</a></li>
<li class="list_item"><a href="#">List Item 06</a></li>
<li class="list_item"><a href="#">List Item 07</a></li>
<li class="list_item"><a href="#">List Item 08</a></li>
</ul>
<div class="spacer_box"><p>This is a spacer box.</p></div>
</div>
</div>
@import url(https://fonts.googleapis.com/css?family=Raleway:300,700);
body {
background: #048;
background: -webkit-linear-gradient(left top, #027, #48a);
background: -moz-linear-gradient(bottom right, #027, #48a);
background: linear-gradient(to bottom right, #027, #48a);
background-attachment: fixed;
color: #fff;
font-family: 'Raleway', Helvetica, Arial, sans-serif;
font-size: 18px;
font-weight: 300;
line-height: 140%;
margin: 0;
height: 100%;
padding: 0;
width: 100%;
}
.page_title,
.what_to_do {
font-weight: 300;
line-height: 120%;
text-align: center;
text-shadow: 0 1px 5px rgba(0,0,0,.8);
text-transform: uppercase;
}
/* PEN STYLES ========== */
a,
.side_menu {
-webkit-transition: all 300ms ease-in-out;
transition: all 300ms ease-in-out;
}
/* MENU CONTAINER ----- */
.side_menu {
background: rgba(0,20,60,.9);
height: 100vh;
left: -250px;
position: fixed;
top: 0;
width: 250px;
}
.side_menu .container {
padding: 0 1em;
}
/* HAMBURGER STYLES ----- */
.burger_box {
display: block;
float: right;
margin-right: -45px;
}
.burger_box a.menu-icon {
display: inline-block;
float: none;
height: 25px;
padding: 10px;
opacity: .5;
width: 25px;
z-index: 100;
}
.burger_box a.menu-icon:hover,
.burger_box a.menu-icon.opened {
opacity: 1;
}
.burger_box a.menu-icon.opened {
background: rgba(0,20,60,.9);
}
.burger_box .menu-icon_box {
display: inline-block;
height: 25px;
position: relative;
text-align: left;
width: 25px;
}
.burger_box .menu-icon_line {
background: #fff;
border-radius: 2px;
display: inline-block;
height: 3px;
position: absolute;
width: 100%;
}
.burger_box .menu-icon_line--1 {
top: 2px;
}
.burger_box .menu-icon_line--2 {
top: 10px;
}
.burger_box .menu-icon_line--3 {
top: 18px;
}
.burger_box .menu-icon_line--1 {
transition: top 200ms 250ms, transform 200ms;
-webkit-transition: top 200ms 250ms, -webkit-transform 200ms;
}
.burger_box .menu-icon_line--2 {
transition: opacity 0ms 300ms;
-webkit-transition: opacity 0ms 300ms;
}
.burger_box .menu-icon_line--3 {
transition: top 100ms 300ms, transform 200ms;
-webkit-transition: top 100ms 300ms, -webkit-transform 200ms;
}
.burger_box .menu-icon.opened .menu-icon_box {
transform: scale3d(0.9, 0.9, 0.9);
-webkit-transform: scale3d(0.9, 0.9, 0.9);
}
.burger_box .menu-icon.opened .menu-icon_line {
top: 10px;
}
.burger_box .menu-icon.opened .menu-icon_line--1 {
transform: rotate3d(0, 0, 1, 45deg);
-webkit-transform: rotate3d(0, 0, 1, 45deg);
transition: top 100ms, transform 200ms 250ms;
-webkit-transition: top 100ms, -webkit-transform 200ms 250ms;
}
.burger_box .menu-icon.opened .menu-icon_line--2 {
opacity: 0;
transition: opacity 200ms;
-webkit-transition: opacity 200ms;
}
.burger_box .menu-icon.opened .menu-icon_line--3 {
transform: rotate3d(0, 0, 1, -45deg);
-webkit-transform: rotate3d(0, 0, 1, -45deg);
transition: top 200ms, transform 200ms 250ms;
-webkit-transition: top 200ms, -webkit-transform 200ms 250ms;
}
/* STAGGER LIST ----- */
.list_load {
display: none;
list-style: none;
padding: 0;
}
.list_item {
margin-left: -20px;
opacity: 0;
-webkit-transition: all 200ms ease-in-out;
transition: all 200ms ease-in-out;
}
.list_item a {
color: #fff;
display: block;
padding: 5px 10px;
text-decoration: none;
}
.list_item a:hover {
background: rgba(255,255,255,.2);
}
// Requires jQuery
$(document).on('click','.js-menu_toggle.closed',function(e){
e.preventDefault(); $('.list_load, .list_item').stop();
$(this).removeClass('closed').addClass('opened');
$('.side_menu').css({ 'left':'0px' });
var count = $('.list_item').length;
$('.list_load').slideDown( (count*.6)*100 );
$('.list_item').each(function(i){
var thisLI = $(this);
timeOut = 100*i;
setTimeout(function(){
thisLI.css({
'opacity':'1',
'margin-left':'0'
});
},100*i);
});
});
$(document).on('click','.js-menu_toggle.opened',function(e){
e.preventDefault(); $('.list_load, .list_item').stop();
$(this).removeClass('opened').addClass('closed');
$('.side_menu').css({ 'left':'-250px' });
var count = $('.list_item').length;
$('.list_item').css({
'opacity':'0',
'margin-left':'-20px'
});
$('.list_load').slideUp(300);
});
Also see: Tab Triggers