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 class="menu off">

	<ul class="nav">
		<li><a href="#0">Home</a></li>
		<li><a href="#0">About</a></li>
		<li><a href="#0">Blog</a></li>
		<li><a href="#0">Contact</a></li>
	</ul>

</nav>

<a href="#0" class="menu-toggle navicon menu1">
	<span></span>
	<span></span>
	<span></span>
</a>

<main>
	<div class="container">

		<article>

			<h1>A flexible full-screen menu</h1>
			<p>The navicon at top right toggles the menu. This is an example of a full-screen menu concept that works well for screens of all sizes. Uses Sass w/ Compass. You can adjust the <code>$numberOfMenuItems</code> variable to suit, or just use it to indicate the number of menu items that should be visible in the viewport without scrolling.</p>
			
			<h2>Uses viewport units*</h2>
			<p>Heads up! This demo uses viewport-relative units for sizing, specifically <code>vh</code> which is pretty well supported in most modern browsers, but is known to be buggy in some mobile browsers. Refer to the compatibility table below for levels of support (courtesy of <a href="http://caniuse.com/">caniuse.com</a>).</p>
			
			<h3>*Some mobile browser support is buggy</h3>
			<iframe src="//caniuse.com/viewport-units/embed/" seamless style="width: 100%; height: 500px;"></iframe>

		</article>

	</div>
</main>


              
            
!

CSS

              
                @import "compass/css3";

/*! 
 * Animated navicon credit to @hugo - https://codepen.io/hugo/pen/LmJsf 
 * My fork (attached as an external resource):
 * https://codepen.io/jreece/pen/fIdqg
*/

// number of items visible in viewport without scrolling
$numberOfMenuItems: 3;

// base menu item height on number of menu items
$menuItemHeight: 100 / $numberOfMenuItems;


// Menu component
// ------------------------------------------------------------

.menu {
	position: fixed;
	overflow-y: auto;
	z-index: 1;
	width: 100vw;
	height: 100vh;
	background: rgba(#EDE1CC, 0.9);
	border-top: 1px solid #3D3527;
	@include transition(opacity 800ms);

	&.off {
		opacity: 0;
		z-index: -1;
		@include transition(opacity 0);
	}

	.nav, .nav li {
		margin: 0;
		padding: 0;
		list-style: none;
		text-align: center;
	}

	.nav a {
		display: block;
		position: relative;
		z-index: 3;
		width: 100%;
		background: transparent;
		border-bottom: 1px solid #3D3527;
		color: #3D3527;
		font-size: 300%;
		letter-spacing: 1vw;
		line-height: $menuItemHeight + vh;
		text-decoration: none;
		text-transform: uppercase;

		&:hover, &:focus {
			background: rgba(#3D3527, 0.9);
			color: #EDE1CC;
			@include transition-property(background-color, color);
			@include transition-duration(800ms);
		}

	}

} // .menu


// Menu toggle button
// ------------------------------------------------------------

.menu-toggle {
	position: fixed;
	z-index: 2;
	right: 0;
	top: 0;
	margin: 4% 6%;

	> span {
		background: #EDE1CC;
	}
	
	&.open {
		background: #3D3527;
	}

} // .menu-toggle


// Pen styles
// ------------------------------------------------------------

*, *:before, *:after {
	@include box-sizing(border-box);
}

html {
	background: #3D3527;
	color: #EDE1CC;
	font-family: Lato, Helvetica, Arial, sans-serif;
	line-height: 1.4;
}

a { color: #EDE1CC; }

.container {
	max-width: 60em;
	margin: 0 auto;
}

article {
	padding: 3em;
}

code {
	margin: 0 0.3em;
	padding: 0.1em 0.3em;
	background: rgba(#ede1cc, 0.5);
	@include border-radius(0.3em);
	color: #3D3527;
}

iframe {
	background: #ede1cc;
	border: 1em solid #ede1cc;
	@include border-radius(1em);
}


              
            
!

JS

              
                
$(function(){

  $('.menu-toggle').on('click', function(e){
    e.preventDefault();
    $('.menu').toggleClass('off');
  });

  $('.navicon').on('click', function() {
    $(this).toggleClass('open');
  });

});
              
            
!
999px

Console