Overly home down menu
Let's make a hamburger menu that move down and up movement and take up short time of interval animation.
This type of hamburger will cover the entire screen at a time to open the man menu to navigate the menu. After opening the man menu a close icon will navigate to close the menu and navigate menu once again.For more details watch the video
Source code of Over home down menu
HTML
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="myNav" class="overlay">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<div class="overlay-content">
<a href="#">Home</a>
<a href="#" id="active">Nav Action</a>
<a href="#">About</a>
<a href="#">HTML</a>
<a href="#">CSS</a>
<a href="#">javaScript</a>
<a href="#">Policy</a>
<a href="#">Privacy</a>
</div>
</div>
<span style="font-size:30px;cursor:pointer" onclick="openNav()">☰ Nav down overlay</span>
<script>
function openNav() {
document.getElementById("myNav").style.height = "100%";
}
function closeNav() {
document.getElementById("myNav").style.height = "0%";
}
</script>
</body>
</html>
CSS
body {
font-family: sans-serif;
}
.overlay {
height: 0%;
width: 100%;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: rgb(54, 54, 54);
overflow-y: hidden;
transition: 0.5s;
}
#active {
color: rgb(12, 138, 117);
}
.overlay-content {
position: relative;
top: 10%;
width: 100%;
text-align: center;
margin-top: 10px;
}
.overlay a {
padding: 5px;
text-decoration: none;
font-size: 26px;
color: #fff;
display: block;
transition: 0.3s;
}
.overlay a:hover, .overlay a:focus {
color: #1044d1;
}
.overlay .closebtn {
position: absolute;
top: 20px;
right: 45px;
font-size: 60px;
}
@media screen and (max-height: 450px) {
.overlay {overflow-y: auto;}
.overlay a {font-size: 20px}
.overlay .closebtn {
font-size: 40px;
top: 15px;
right: 35px;
}
}
Comments
Post a Comment