Responsive Toggle Menu Using jQuery
Hello Friends, Today in this blog you will learn How to Create a Responsive Toggle Menu Using jQuery HTML CSS.
In the earlier blog, I have shared to Make Testimonial Slider On Website Using HTML CSS JavaScript, Now it's time to learn How to Create a Responsive Toggle Menu Using jQuery HTML CSS.
In this blog we learn How to Create a Responsive Toggle Menu Using jQuery HTML CSS.
So Here is the code and my work. I hope you are gonna love this and share whit your friends too. So let's Start learning How to Create a Responsive Toggle Menu Using jQuery HTML CSS from scratch. So Let's start..
STEP 1: Open any code editor
STEP 2: Create a index.html file with html extension
STEP 3: Create a style.css file with css extension
STEP 4: Connect style.css file to the index.html file code below
<link rel="stylesheet" type="text/css" href="style.css">
STEP 5: Add this Code in index.html page
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="fonts/css/all.css">
</head>
<body>
<div class="container">
<nav>
<div class="logo">
<h1>Logo</h1>
</div>
<ul class="nav-wrap">
<li><a href="#" class="active">Home</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Blog</a></li>
</ul>
<div class="openNav">
</div>
</nav>
<h2>Heading Here</h2>
</div>
<script type="text/javascript" src="min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".openNav").click(function(){
$(".openNav").toggleClass("cross");
$(".nav-wrap").toggleClass("cross");
})
})
</script>
</body>
</html>
STEP 6: Add this Code in style.css page
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body{
font-family: verdana;
}
.container{
background-image: url('https://image.freepik.com/free-vector/white-product-podium-with-green-tropical-palm-leaves-golden-round-arch-green-wall_87521-3023.jpg');
width: 100%;
height: 100vh;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
}
nav{
width: 90%;
max-width: 1200px;
margin: auto;
height: 60px;
background-color: #fff;
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
}
.logo{
font-size: 25px;
color: #415F17;
}
.nav-wrap{
list-style: none;
}
.nav-wrap li{
display: inline-block;
margin: 0 6px;
}
.nav-wrap li a{
text-decoration: none;
color: #000;
display: block;
padding: 10px 20px;
border-radius: 3px;
}
.active,.nav-wrap li a:hover{
background-color: #415F17;
color: #fff !important;
transition: .7s;
}
.openNav{
width: 30px;
height: 40px;
position: relative;
display: none;
}
.openNav::after{
font-family: "Font Awesome 5 Free";
font-weight: 900;
content: "\f0c9";
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
font-size: 30px;
color: #415F17;
cursor: pointer;
}
.openNav.cross::after{
content: "\f00d";
}
h2{
text-align: center;
color: #fff;
margin: 50px 0px;
}
@media (max-width: 848px) {
.logo{
font-size: 22px;
}
.nav-wrap li{
margin: 0;
}
}
@media (max-width: 750px) {
.openNav{
display: block;
}
.nav-wrap{
position: fixed;
width: 90%;
top: 60px;
left: 50%;
transform: translateX(-50%);
background-color: #fff;
max-height: 0px;
overflow: hidden;
transition: .4s;
}
.nav-wrap.cross{
max-height: 230px;
}
.nav-wrap li{
display: block;
margin: 1px 0px;
}
.nav-wrap li a{
border-radius: 0px;
}
}
Step 7) Now Copy File Path and pate it any browser.
Step 8) See magic.....😊
Thank you...........
You can also read: How to creating an image slider using JavaScript HTML and CSS

0 Comments