JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
<section class="wrapper">
<section class="material-design-hamburger">
<button class="material-design-hamburger__icon">
<span class="material-design-hamburger__layer"></span>
</button>
</section>
<section class="menu menu--off">
<div>Android's Material Design Hamburger Animation</div>
<div>Adapted for the web by <a href="https://swirlycheetah.com" target="_blank">Chris Wheatley</a></div>
<div><a href="https://github.com/swirlycheetah/material-design-hamburger" target="_blank">Available on GitHub</a></div>
<div><a href="https://twitter.com/swirlycheetah" target="_blank">Follow me on Twitter @swirlycheetah</a></div>
</section>
</section>
@import url(https://fonts.googleapis.com/css?family=Roboto);
body {
background: #009688;
}
.wrapper {
height: 100%;
transition: all 300ms ease-in-out;
margin: 1em 0;
padding: 0;
}
.background--blur {
background: #004d40;
}
.menu {
font-size:2em;
font-family: 'Roboto', sans-serif;
color: #333;
}
.menu div {
margin: 1em;
padding-bottom: 1em;
border-bottom: 1px solid #ccc;
}
.menu a {
text-decoration: none;
color: #3367d6;
}
.menu a:hover {
text-decoration: underline;
}
.menu div:last-child {
border: 0;
}
.menu--off {
position: absolute;
left: -50%;
width: 50%;
display: block;
background: #eee;
min-height: 600px;
height: 125%;
margin-top: 1em;
transition: all 300ms;
}
.menu--on {
left: 0;
box-shadow: 8px 8px 20px 0 rgba(0, 0, 0, 0.2);
transition: all 300ms;
}
.material-design-hamburger button {
display: block;
border: none;
background: none;
outline: 0;
}
.material-design-hamburger__icon {
padding: 3rem 1rem;
cursor: pointer;
}
.material-design-hamburger__layer {
display: block;
width: 100px;
height: 10px;
background: #eee;
position: relative;
animation-duration: 300ms;
animation-timing-function: ease-in-out;
}
.material-design-hamburger__layer:before, .material-design-hamburger__layer:after {
display: block;
width: inherit;
height: 10px;
position: absolute;
background: inherit;
left: 0;
content: '';
animation-duration: 300ms;
animation-timing-function: ease-in-out;
}
.material-design-hamburger__layer:before {
bottom: 200%;
}
.material-design-hamburger__layer:after {
top: 200%;
}
.material-design-hamburger__icon--to-arrow {
animation-name: material-design-hamburger__icon--slide;
animation-fill-mode: forwards;
}
.material-design-hamburger__icon--to-arrow:before {
animation-name: material-design-hamburger__icon--slide-before;
animation-fill-mode: forwards;
}
.material-design-hamburger__icon--to-arrow:after {
animation-name: material-design-hamburger__icon--slide-after;
animation-fill-mode: forwards;
}
.material-design-hamburger__icon--from-arrow {
animation-name: material-design-hamburger__icon--slide-from;
}
.material-design-hamburger__icon--from-arrow:before {
animation-name: material-design-hamburger__icon--slide-before-from;
}
.material-design-hamburger__icon--from-arrow:after {
animation-name: material-design-hamburger__icon--slide-after-from;
}
@keyframes material-design-hamburger__icon--slide {
0% {
}
100% {
transform: rotate(180deg);
}
}
@keyframes material-design-hamburger__icon--slide-before {
0% {
}
100% {
transform: rotate(45deg);
margin: 3% 37%;
width: 75%;
}
}
@keyframes material-design-hamburger__icon--slide-after {
0% {
}
100% {
transform: rotate(-45deg);
margin: 3% 37%;
width: 75%;
}
}
@keyframes material-design-hamburger__icon--slide-from {
0% {
transform: rotate(-180deg);
}
100% {
}
}
@keyframes material-design-hamburger__icon--slide-before-from {
0% {
transform: rotate(45deg);
margin: 3% 37%;
width: 75%;
}
100% {
}
}
@keyframes material-design-hamburger__icon--slide-after-from {
0% {
transform: rotate(-45deg);
margin: 3% 37%;
width: 75%;
}
100% {
}
}
(function() {
'use strict';
document.querySelector('.material-design-hamburger__icon').addEventListener(
'click',
function() {
var child;
document.body.classList.toggle('background--blur');
this.parentNode.nextElementSibling.classList.toggle('menu--on');
child = this.childNodes[1].classList;
if (child.contains('material-design-hamburger__icon--to-arrow')) {
child.remove('material-design-hamburger__icon--to-arrow');
child.add('material-design-hamburger__icon--from-arrow');
} else {
child.remove('material-design-hamburger__icon--from-arrow');
child.add('material-design-hamburger__icon--to-arrow');
}
});
})();
Also see: Tab Triggers