cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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 lang="en" class="no-js">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" type="text/css" href="nav.css">
	<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
	<link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
	<title>Full Screen Navigation</title>
</head>
<body>
	<div class="main">
		<h1>Full-Screen Hidden Navigation Using SVG Animations</h1>
		<p>It works on mobile devices as well.</p>
	</div>
	<a href="#navi" class="navi-trigger">
		<span class="navi-icon">
			<svg viewBox="0 0 800 600">
    			<path d="M300,220 C300,220 520,220 540,220 C740,220 640,540 520,420 C440,340 300,200 300,200" id="top"></path>
    			<path d="M300,320 L540,320" id="middle"></path>
    			<path d="M300,210 C300,210 520,210 540,210 C740,210 640,530 520,410 C440,330 300,190 300,190" id="bottom" transform="translate(480, 320) scale(1, -1) translate(-480, -318) "></path>
  			</svg>
		</span>
	</a>

	<!-- Hidden Navi Menu -->
	<div id="navi" class="navi">
		<div class="navigation-wrapper">
			<div class="half-block">
				<h2>Navigation</h2>

				<nav>
					<ul class="primary-navi">
						<li><a href="#">Link 1</a></li>
						<li><a href="#">Link 2</a></li>
						<li><a href="#">Link 3</a></li>
						<li><a href="#">Link 4</a></li>
					</ul>
				</nav>
			</div>
		</div>
	</div>
</body>
</html>
            
          
!
            
              /*

Primary Style

*/

h1, h2 {
	font-family: 'Roboto', sans-serif;
	font-weight: 700;
  color: #FFF;
  line-height: 58px;
}

p {
	font-family: 'Raleway', sans-serif;
	font-weight: 500;
  color: #FFF;
}

body {
	font-size: 1.6em;
	background-color: #D7DADB;
	/* Prevent horizontal Scrolling */
	height: 100vh;
	margin: 0;
  margin-top: 0;
}

a {
	text-decoration: none;
}

ul {
	list-style: none;
	padding-left: 0;
}

/*

div.main Stuff

*/

div.main {
  	position: relative;
  	z-index: 2;
  	/* fix bug on iOS */
  	height: 100vh;
  	overflow-y: auto;
 	-webkit-overflow-scrolling: touch;
  	padding: 200px 5%;
  	background-color: #2C3E50;
  	/* Force Hardware Acceleration in WebKit */
  	-webkit-transform: translateZ(0);
  	-moz-transform: translateZ(0);
  	-ms-transform: translateZ(0);
  	-o-transform: translateZ(0);
  	transform: translateZ(0);
  	-webkit-backface-visibility: hidden;
  	backface-visibility: hidden;
  	-webkit-transition: -webkit-transform 0.7s;
  	-moz-transition: -moz-transform 0.7s;
  	transition: transform 0.7s;
  	-webkit-transition-timing-function: cubic-bezier(0.91, 0.01, 0.6, 0.99);
  	-moz-transition-timing-function: cubic-bezier(0.91, 0.01, 0.6, 0.99);
  	transition-timing-function: cubic-bezier(0.91, 0.01, 0.6, 0.99);
}

div.main > h1, div.main > p {
  	text-align: center;
}

div.main > h1 {
  	font-size: 2.6rem;
  	margin-bottom: 1em;
}

div.main > p {
  	max-width: 450px;
  	margin: 0 auto;
  	line-height: 1.6;
}

svg {
  width: 200px;
  height: 150px;
  cursor: pointer;
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0);
  -ms-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}

path {
  fill: none;
  -webkit-transition: stroke-dashoffset 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25), stroke-dasharray 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25);
  -moz-transition: stroke-dashoffset 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25), stroke-dasharray 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25);
  -o-transition: stroke-dashoffset 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25), stroke-dasharray 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25);
  -ms-transition: stroke-dashoffset 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25), stroke-dasharray 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25);
  transition: stroke-dashoffset 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25), stroke-dasharray 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25);
  stroke-width: 10px;
  stroke: #FFF;
  stroke-dashoffset: 0px;
}

path#top,
path#bottom {
  stroke-dasharray: 240px 950px;
}

path#middle {
  stroke-dasharray: 240px 240px;
}

.cross path#top,
.cross path#bottom {
  stroke-dashoffset: -650px;
  stroke-dashoffset: -650px;
}

.cross path#middle {
  stroke-dashoffset: -115px;
  stroke-dasharray: 1px 220px;
}

.navigation-is-open div.main {
  	-webkit-transform: translateY(100%);
  	-moz-transform: translateY(100%);
  	-ms-transform: translateY(100%);
  	-o-transform: translateY(100%);
  	transform: translateY(100%);
}

.navi-trigger {
  	position: fixed;
  	z-index: 3;
    top: 40px;
}



.navi-trigger .navi-icon::before, .navi-trigger .navi-icon:after {
  	/* upper and lower lines of the menu icon */
  	content: '';
  	position: absolute;
  	top: 0;
  	right: 0;
  	width: 100%;
  	height: 100%;
}

.navi-trigger svg {
  	position: absolute;
  	top: 0;
  	left: 0;
}

.no-touch .navigation-is-open .navi-trigger:hover .navi-icon::after, .no-touch .navigation-is-open .navi-trigger:hover .navi-icon::before {
  	top: 0;
}

.navi {
  	position: fixed;
  	z-index: 1;
  	top: 0;
  	left: 0;
  	height: 100%;
  	width: 100%;
  	background-color: #6DBCDB;
  	visibility: hidden;
  	-webkit-transition: visibility 0s 0.7s;
  	-moz-transition: visibility 0s 0.7s;
  	transition: visibility 0s 0.7s;
}

.navi .navigation-wrapper {
  	/* all navigation content */
  	height: 100%;
  	overflow-y: auto;
  	-webkit-overflow-scrolling: touch;
  	padding: 40px 5% 40px calc(5% + 80px);
  	/* Force Hardware Acceleration in WebKit */
  	-webkit-transform: translateZ(0);
  	-moz-transform: translateZ(0);
  	-ms-transform: translateZ(0);
  	-o-transform: translateZ(0);
  	transform: translateZ(0);
  	-webkit-backface-visibility: hidden;
  	backface-visibility: hidden;
  	-webkit-transform: translateY(-50%);
  	-moz-transform: translateY(-50%);
  	-ms-transform: translateY(-50%);
  	-o-transform: translateY(-50%);
  	transform: translateY(-50%);
  	-webkit-transition: -webkit-transform 0.7s;
  	-moz-transition: -moz-transform 0.7s;
  	transition: transform 0.7s;
  	-webkit-transition-timing-function: cubic-bezier(0.86, 0.01, 0.77, 0.78);
  	-moz-transition-timing-function: cubic-bezier(0.86, 0.01, 0.77, 0.78);
  	transition-timing-function: cubic-bezier(0.86, 0.01, 0.77, 0.78);
}

.navi .half-block {
  text-align: center;
}

.navigation-is-open .navi {
  	visibility: visible;
  	-webkit-transition: visibility 0s 0s;
  	-moz-transition: visibility 0s 0s;
  	transition: visibility 0s 0s;
}

.navigation-is-open .navi .navigation-wrapper {
  	-webkit-transform: translateY(0);
  	-moz-transform: translateY(0);
  	-ms-transform: translateY(0);
  	-o-transform: translateY(0);
  	transform: translateY(0);
  	-webkit-transition: -webkit-transform 0.5s;
  	-moz-transition: -moz-transform 0.5s;
  	transition: transform 0.5s;
  	-webkit-transition-timing-function: cubic-bezier(0.82, 0.01, 0.77, 0.78);
  	-moz-transition-timing-function: cubic-bezier(0.82, 0.01, 0.77, 0.78);
  	transition-timing-function: cubic-bezier(0.82, 0.01, 0.77, 0.78);
}

.navi > h2 {
  	position: relative;
  	margin-bottom: 1.7em;
  	font-size: 1.3rem;
  	font-weight: 800;
  	color: #2C3E50;
  	text-transform: uppercase;
}

.navi > h2::after {
  	/* bottom separation line */
  	content: '';
  	position: absolute;
  	left: 0;
  	bottom: -20px;
  	height: 1px;
  	width: 60px;
  	background-color: #2C3E50;
}

.navi .primary-navi {
  	margin-top: 60px;
}

.navi .primary-navi > li {
  	margin: 1.6em 0;
}

.navi .primary-navi a {
  	font-family: 'Raleway', sans-serif;
  	font-size: 2.4rem;
  	color: #D7DADB;
  	display: inline-block;
}

.navi .primary-navi a.selected {
  	color: #ffffff;
}

.no-touch .navi .primary-navi a:hover {
  	color: #ffffff;
}

.no-js div.main {
  	overflow: visible;
}

.no-js .navi {
  	visibility: visible;
}

.no-js .navi .navigation-wrapper {
  	height: auto;
  	overflow: visible;
  	padding: 200px 5%;
  	-webkit-transform: translateY(0);
  	-moz-transform: translateY(0);
  	-ms-transform: translateY(0);
  	-o-transform: translateY(0);
  	transform: translateY(0);
}

/*

Media Queries Mobile Devices

*/
@media only screen and (min-width: 786px){
	div.div.main {
		padding: 250px 10%;
	}

	div.div.main > h1 {
		font-size: 2.6em;
	}

	div.div.main > p {
		font-size: 1.6em;
	}

}

@media only screen and (min-width: 1170px) {
	
	.navi .navigation-wrapper {
    	padding: 62px 20%;
  	}
  	
  	.navi .navigation-wrapper::after {
    	clear: both;
    	content: "";
    	display: table;
  	}
  	
  	.navi .half-block {
    	width: 100%;
    	float: left;
  	}
  	
  	.navi .primary-navi {
    	margin-top: 0;
  	}
  
  	.navi h2 {
    	font-size: 1.5rem;
    	margin-bottom: 5.6em;
  	}
  
  	.navi .primary-navi li {
    	margin: 2em 0;
  	}
  
  	.navi .primary-navi a {
    	font-size: 2.4rem;
  	}
}
            
          
!
            
              // for the menu icon
(function() {
	var i, resize;

  	$("a").click(function() {
    clearInterval(i);
    return $("a").toggleClass("cross");
  	});

  	resize = function() {
    return $("body").css({
    // "margin-top": ~~((window.innerHeight - 150) / 2) + "px"
    });
  	};

  	$(window).resize(resize);

	resize();

}).call(this)

// move the front page
jQuery(document).ready(function($){
	var isLateralNavAnimating = false;
	
	//open/close lateral navigation
	$('.navi-trigger').on('click', function(event){
		event.preventDefault();
		//stop if nav animation is running 
		if( !isLateralNavAnimating ) {
			if($(this).parents('.csstransitions').length > 0 ) isLateralNavAnimating = true; 
			
			$('body').toggleClass('navigation-is-open');
			$('.navigation-wrapper').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
				//animation is over
				isLateralNavAnimating = false;
			});
		}
	});
});

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console