<div class="nav-menu">
<h2>menu</h2>
</div>
<div class="main-content center">
<h1>Welcome to my full page slide down menu</h1>
</div>
<nav class="menu-container">
<div class="menu-content center">
<ul class="list-items">
<li>home</li>
<li>about</li>
<li>portfolio</li>
<li>contact</li>
</ul>
</div>
</nav>
* {
margin: 0;
padding: 0;
color: #fff;
}
body {
font-family: sans-serif;
background: #2b2769;
text-align: center;
}
.main-content {
font-size: 30px
}
.nav-menu{
z-index: 5;
position: absolute;
top: 20px;
right: 30px;
cursor: pointer;
}
.menu-container {
z-index:1;
position:fixed;
height: 100%;
width: 100%;
background: #E94444;
}
.center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
li {
list-style-type: none;
font-size: 50px;
margin-bottom: 20px;
font-weight: bold;
}
var menuIcon = $(".nav-menu");
var menuToggle = new TimelineMax({paused:true, reversed:true});
var slideDown = $(".menu-container");
var listItems = $(".list-items > li");
TweenMax.set(slideDown, {
y: '-100%'
});
// TweenMax.set(listItems, {
// y: '0'
// });
menuToggle
.to(menuIcon, .5, {
x:'-30',
ease: Back.easeOut
// ease: Back.easeIn.config(2.2)
})
.to(slideDown, 1, {
y: '0%',
ease: Back.easeOut
})
.staggerFrom(listItems, .25, {
y: '-30',
ease: Power1.easeOut
}, .1);
menuIcon.click(function () {
menuToggle.reversed() ? menuToggle.restart() : menuToggle.reverse();
});
This Pen doesn't use any external CSS resources.