123

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

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);
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console