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.

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


            
          
!
            
              @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);
}


            
          
!
            
              
$(function(){

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

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

});
            
          
!
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