<div class="wrapper">
<nav>
<div id="drop">
<div>
<span></span>
<span></span>
<span></span>
</div>
</div>
</nav>
<ul>
<li>home</li>
<li>about</li>
<li>login</li>
<li>contact</li>
<li>privacy</li>
</ul>
<h1><br><br>Scroll<br>⇓</h1>
</div>
* {
font-family: Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana,
"sans-serif";
font-weight: 400;
margin: 0;
padding: 0;
text-align: center;
text-transform: uppercase;
}
.hidden {
overflow: hidden;
}
html, body {
color: #fff;
background-color: #1c1c1c;
}
.wrapper {
background: linear-gradient(
45deg,
rgba(245, 41, 55, 1),
rgba(124, 0, 255, 1)
);
width: 500px;
height: 1200px;
margin: 0 auto;
overflow: hidden;
}
nav {
width: 90%;
height: 90px;
padding: 0 5%;
position: relative;
display: flex;
justify-content: flex-end;
align-items: center;
background-color: #f8f8f8;
}
nav ~ ul {
display: flex;
position: absolute;
flex-direction: column;
justify-content: center;
align-items: center;
left: 1%;
right: 1%;
opacity: 0;
visibility: hidden;
z-index: 2;
list-style: none;
transition: 0s;
}
nav ~ ul > li {
color: rgba(119, 0, 255, 1);
padding: 10px;
cursor: pointer;
font-size: 30px;
}
nav ~ ul > li:hover {
filter: brightness(200%);
}
nav.open ~ ul {
transition: 0.75s ease-in-out;
visibility: visible;
opacity: 1;
}
#drop {
cursor: pointer;
position: fixed;
background-color: #f8f8f8;
width: 70px;
height: 70px;
border-radius: 0 50% 50%;
transform: rotate(45deg);
transition: border-radius 0.5s;
}
nav.open > #drop{
transition: 0.5s ease-in-out;
box-shadow: 0 0 0 1000px #f8f8f8, inset 0 0 0 20px #f8f8f8;
position: relative;
}
#drop.active {
border-radius: 50%;
animation: drop 0.3s forwards;
}
#drop > div {
transform: rotate(-45deg);
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#drop span {
display: block;
background-color: rgba(119, 0, 255, 1);
width: 40px;
height: 3px;
margin: 5px 0;
transition: 0.5s;
}
#drop span.open:nth-child(1) {
transform: rotate(45deg) translate(5px, 5px);
}
#drop span.open:nth-child(2) {
transform: rotate(-45deg) translate(5px, -5px);
}
#drop span.open:nth-child(3) {
opacity: 0;
}
@keyframes drop {
0% {
transform: translateY(0) rotate(45deg);
}
50% {
transform: translateY(30px) rotate(45deg);
}
100% {
transform: translateY(10px) rotate(45deg);
}
}
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll > 100)
$("#drop").addClass("active");
else if (scroll < 80)
$("#drop").removeClass("active");
});
$("#drop, nav ~ ul li").click(function() {
$("nav, #drop span").toggleClass("open");
$("body").toggleClass("hidden");
$(window).scrollTop(0); //cheating
});
This Pen doesn't use any external CSS resources.