Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <div class="navicon" id="navicon"><span></span></div>

<nav class="main-nav" id="main-nav" role="navigation">
	<ul class="main-nav__list">
		<li><a class="main-nav__link" href="#!0">&Uacute;vod</a></li>
		<li><a class="main-nav__link" href="#!0">Produkty</a></li>
		<li><a class="main-nav__link" href="#!0">Inform&aacute;cie</a></li>
		<li><a class="main-nav__link" href="#!0">Kontakt</a></li>
		<!--<li><a class="main-nav__link" href="#!0">Cart <span>(5)</span></a></li> -->
	</ul>
	<div class="main-nav__info">
		<p>Aktuálne novinky o nových motívoch svadobných oznamení, pozvánok a etikiet, nájdete aj na týchto sociálnych sieťach:</p>
	</div>
	<div class="main-nav__social">
		<a href="#!0" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64"><path d="M64,12.2c-2.4,1-4.9,1.8-7.5,2.1c2.7-1.6,4.8-4.2,5.8-7.3c-2.5,1.5-5.3,2.6-8.3,3.2C51.5,7.6,48.1,6,44.3,6 c-7.3,0-13.1,5.9-13.1,13.1c0,1,0.1,2,0.3,3C20.6,21.6,10.9,16.3,4.5,8.4c-1.1,1.9-1.8,4.2-1.8,6.6c0,4.6,2.3,8.6,5.8,10.9 c-2.2-0.1-4.2-0.7-5.9-1.6c0,0.1,0,0.1,0,0.2c0,6.4,4.5,11.7,10.5,12.9c-1.1,0.3-2.3,0.5-3.5,0.5c-0.8,0-1.7-0.1-2.5-0.2 c1.7,5.2,6.5,9,12.3,9.1c-4.5,3.5-10.2,5.6-16.3,5.6c-1.1,0-2.1-0.1-3.1-0.2C5.8,55.8,12.7,58,20.1,58c24.2,0,37.4-20,37.4-37.4 c0-0.6,0-1.1,0-1.7C60,17.1,62.2,14.8,64,12.2z"></path></svg></a>
		<a href="#!0" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64"><path d="M32,5.766c8.544,0,9.556,0.033,12.931,0.187c3.642,0.166,7.021,0.895,9.621,3.496 c2.6,2.6,3.329,5.979,3.496,9.621c0.154,3.374,0.187,4.386,0.187,12.931s-0.033,9.556-0.187,12.931 c-0.166,3.642-0.895,7.021-3.496,9.621c-2.6,2.6-5.98,3.329-9.621,3.496c-3.374,0.154-4.386,0.187-12.931,0.187 s-9.557-0.033-12.931-0.187c-3.642-0.166-7.021-0.895-9.621-3.496c-2.6-2.6-3.329-5.979-3.496-9.621 C5.798,41.556,5.766,40.544,5.766,32s0.033-9.556,0.187-12.931c0.166-3.642,0.895-7.021,3.496-9.621 c2.6-2.6,5.979-3.329,9.621-3.496C22.444,5.798,23.456,5.766,32,5.766 M32,0c-8.691,0-9.78,0.037-13.194,0.193 c-5.2,0.237-9.768,1.511-13.436,5.178C1.705,9.037,0.43,13.604,0.193,18.806C0.037,22.22,0,23.309,0,32 c0,8.691,0.037,9.78,0.193,13.194c0.237,5.2,1.511,9.768,5.178,13.436c3.666,3.666,8.234,4.941,13.436,5.178 C22.22,63.963,23.309,64,32,64s9.78-0.037,13.194-0.193c5.199-0.237,9.768-1.511,13.436-5.178c3.666-3.666,4.941-8.234,5.178-13.436 C63.963,41.78,64,40.691,64,32s-0.037-9.78-0.193-13.194c-0.237-5.2-1.511-9.768-5.178-13.436 c-3.666-3.666-8.234-4.941-13.436-5.178C41.78,0.037,40.691,0,32,0L32,0z"></path><path d="M32,15.568c-9.075,0-16.432,7.357-16.432,16.432c0,9.075,7.357,16.432,16.432,16.432 S48.432,41.075,48.432,32C48.432,22.925,41.075,15.568,32,15.568z M32,42.667c-5.891,0-10.667-4.776-10.667-10.667 c0-5.891,4.776-10.667,10.667-10.667c5.891,0,10.667,4.776,10.667,10.667C42.667,37.891,37.891,42.667,32,42.667z"></path><circle cx="49.082" cy="14.918" r="3.84"></circle></svg></a>
	</div>
	<ul class="main-nav__legal">
		<li><a class="main-nav__link" href="#!0">FAQ &amp; Shipping</a></li>
		<li><a class="main-nav__link" href="#!0">Obchodné podmienky</li>
	</ul>
</nav>

<div class="overlay"></div>
              
            
!

CSS

              
                @mixin animation($args...) {
    $name: unique-id(); // name for @keyframes
    $args: join((), $args, 'space'); // conform args as SSV
    animation: $name + ' ' + $args;
    @keyframes #{$name} {
        @content;
    }
}

$black: #000;
$white: #fff;
$gray-30: #767676;
$gray-100: #2a2a2a;
$gold: #b7ac7f;
$raleway: "Raleway", sans-serif;
$spectral: "Spectral", serif;

// --------------------------------------------------------
// Navicon
// --------------------------------------------------------

$navicon-width: ($space - $space-xs);
$navicon-height: $navicon-width;
$_g: $navicon-width;
$_nw: ($navicon-width * 3);
$_nh: ($navicon-height *3);
$_nbw: ($_nw - $_g);
$_nbh: (($_nw / $space) * 1px);
$_nbs: (($_nw / $space-sm) * 1px);

.navicon {
	overflow: auto;
    position: fixed;
    top: $space;
    right: $space;
    width: $_nw;
    height: $_nh;
	border-radius: $space-xs;
	background-color: whitesmoke;
	z-index: 10;
	transition: all 680ms;

	&:hover {
		cursor: pointer;
		background-color: rgba(0,0,0,.05);
	}

	span {
		@include burger($_nbw, $_nbh, $_nbs, $gray-30, 0, .34s);
		position: absolute;
		top: 50%;
		left: 50%;
		margin-top: (($_nbh / 2) * -1);
		transform: translateX(-50%);
	}
}

.js_is-active {
	background-color: crimson;

	&:hover {
		background-color: crimson;
	}

	span {
		@include burger-to-cross;

		&::before,
		&::after {
			background-color: $white;
		}
	}
}

// --------------------------------------------------------
// Navigation
// --------------------------------------------------------
$main-nav-gutter-x: $space-xl;
$main-nav-gutter-y: $space-xl;

.main-nav {
	z-index: 9;
	position: fixed;
	top: 0;
	right: 0;
	width: 100%;
	max-width: 515px;
	height: 100%;
	padding: $space-xl $space-xl $space $space-xl;
	overflow-y: auto;
	background-color: $gray-100;
	transform: translateX(100%);
	transition: transform .55s cubic-bezier(0.785, 0.135, 0.15, 0.86);
	// ----------------------------------------------------
	// Menu-items wrapper
	// ----------------------------------------------------
	&__list {
		li {
			opacity: 0;
			transform: translateX($space-xl);
			transition: all .3s ease;
		}
	}
	// ----------------------------------------------------
	// Menu-link
	// ----------------------------------------------------
	&__link {
		display: block;
		padding: $space 0;
        color: $white;
        font-family: $raleway;
		font-size: 1.5rem;
		font-weight: 600;
		letter-spacing: $space-xs;
        text-decoration: none;
        text-transform: uppercase;
		transition: all .3s ease;
		&:hover {
			color: $gold;
		}
        span {
			color: $gold;
		}
	}
	// ----------------------------------------------------
	// Menu info
	// ----------------------------------------------------
	&__info {
		opacity: 0;
		margin: $space 0 $space-lg;
		color: $white;
		font-family: $spectral;
		font-size: 1.05rem;
		letter-spacing: $space-x1;
		transform: translateY(30px);
		transition: all .4s ease;
	}
	&__social {
		opacity: 0;
		overflow: hidden;
		position: relative;
		margin-top: $space-lg;
		padding-bottom: $space-lg;
		transform: translateY($space-lg);
		transition: all .4s ease;
		&::after {
			content: "";
			position: absolute;
			bottom: 0;
			left: -100%;
			width: 100%;
			height: $space-x2;
			background-color: $gold;
		}
		a {
			display: inline-block;
			width: $space-lg;
			height: $space-lg;
			&:not(:first-of-type) {
				margin-left: $space-lg;
			}
			&:hover {
				path, 
				circle {
					fill: $gold;
				}
			}
		}
		svg {
			width: 100%;
			height: 100%;
			path, 
			circle {
				fill: $white;
				transition: all .3s ease;
			}
		}
	}
	&__legal {
		opacity: 0;
		margin-top: $space-lg;
		transform: translateY($space-lg);
		transition: all .4s ease;

		li a {
			font-size: 0.9rem;
			transition: all .3s ease;
			&:hover {
				color: $gold;
			}
		}
	}
}

.overlay {
	z-index: 1;
	opacity: 0;
	visibility: hidden;
	position: fixed;
	top: 0; right: 0; bottom: 0; left: 0;
	width: 100%;
	height: 100%;
	background-color: transparentize($gray-100, .25);
	transition: all 0.3s ease-in-out;
}

// --------------------------------------------------------
// JS
// --------------------------------------------------------
.js_show-menu {
	transform: translateX(0);

	.main-nav__list {
		li {
			transform: translateX(0);
			opacity: 1;

			@for $i from 1 through 20 { 
				&:nth-child(#{$i}) {
					transition-delay: $i * 0.15s;
				}
			}
		}
	}
	.main-nav__info,
	.main-nav__social,
	.main-nav__legal {
		opacity: 1;
		transform: translateY(0);
		transition-delay: .85s;
	}
	.main-nav__social::after {
		transform: translateX(100%);
		transition-property: transform;
		transition-duration: 340ms;
		transition-timing-function: ease-in;
		transition-delay: .95s;
	}
}
.js_show-overlay {
	opacity: 0.8;
	visibility: visible;
}

// --------------------------------------------------------
// Reset
// --------------------------------------------------------
ul {
	margin: 0;
	padding: 0;
	list-style-type: none;
}
p {
	margin: 0;
}
              
            
!

JS

              
                // jQuery-style functions in pure JS
// hasClass, addClass, removeClass, toggleClass
// @author: Todd Motto
// @link: http://bit.ly/pure-js-jquery-style-functions
// @link: https://toddmotto.com/labs/reusable-js/

// hasClass
function hasClass(elem, className) {
  return new RegExp(' ' + className + ' ').test(' ' + elem.className + ' ');
}

// addClass
function addClass(elem, className) {
  if (!hasClass(elem, className)) {
    elem.className += ' ' + className;
  }
}

// removeClass
function removeClass(elem, className) {
  var newClass = ' ' + elem.className.replace( /[\t\r\n]/g, ' ') + ' ';
  if (hasClass(elem, className)) {
    while (newClass.indexOf(' ' + className + ' ') >= 0 ) {
      newClass = newClass.replace(' ' + className + ' ', ' ');
    }
  elem.className = newClass.replace(/^\s+|\s+$/g, '');
  }
}

// toggleClass
function toggleClass(elem, className) {
  var newClass = ' ' + elem.className.replace( /[\t\r\n]/g, " " ) + ' ';
  if (hasClass(elem, className)) {
    while (newClass.indexOf(" " + className + " ") >= 0 ) {
      newClass = newClass.replace( " " + className + " " , " " );
    }
    elem.className = newClass.replace(/^\s+|\s+$/g, '');
  } else {
    elem.className += ' ' + className;
  }
}

//document.getElementById('navicon').onclick = function() {
    //toggleClass(this, 'js_is-active');
//}

var menu = document.querySelector('.main-nav'),
    navicon = document.querySelector('.navicon'),
	overlay = document.querySelector('.overlay');

navicon.onclick = function() {
	toggleClass(this, 'js_is-active');
    toggleClass(menu, 'js_show-menu');
	toggleClass(overlay, 'js_show-overlay');
};

overlay.onclick = function() {
	removeClass(navicon, 'js_is-active');
	removeClass(menu, 'js_show-menu');
	removeClass(this, 'js_show-overlay');
}
              
            
!
999px

Console