🔒 Closed Nav bar animation mobile view

Status
Not open for further replies.

SUNRAI

Eternal Poster
Pa help naman po pano kopo kayang gagawin na pag on click ng fa-bars ko eh lalabas sa gilid nang screen yung nav links tas pag click uli sa fa-bars mag clo close sya.

 
Gamit ka jquery

Lagyan mo yung fa bars ng id na btn
Sa navbar naman lagyan mo id na nav

Sa jquery mo gawa ka script na

$('#btn').click(function (){
$('#nav').show()
})
 
$(document).ready(function(){
$('#btn').click(function (){
$('.nav-links-m').show()
})
})
});

Ganto ginawa ko sir ayaw mag respond
 
<head>
<link rel="preconnect" href="You do not have permission to view the full content of this post. Log in or register now.">
<link href="You do not have permission to view the full content of this post. Log in or register now." rel="stylesheet">
<link rel="stylesheet" href="You do not have permission to view the full content of this post. Log in or register now.">
<title>Planets</title>
<link rel="stylesheet" href="./style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<nav>
<div class="logo">PLANETS</div>
<ul class="nav-links" id="link">
<li><a href="#">home</a></li>
<li><a href="#">about</a></li>
<li><a href="#">contact</a></li>
</ul>
<span class="slide">
<a href="#" onClick="openSlideMenu()">
<i class="fa fa-bars fa-2x"></i>
</a>
</span>
</nav>
</body>

CSS
* {
margin: 0px;
padding:0px;
box-sizing: border-box;
}

body {
background-color: black;
overflow-x: hidden;
}

nav {
display: flex;
justify-content: space-around;
padding: 10px;
color: white;
border-bottom:1px solid #dddddd;
font-family: 'Poppins', sans- serif;
}

.logo {
font-weight: 400;
letter-spacing: 1px;
color: #8540ff;
font-size: 1.5rem;
flex: 1 1 auto;
}

.nav-links {
display: flex;
justify-content: space-around;
flex: 1 1 auto;
transition: all 1s ease;
}

.nav-links a {
text-decoration: none;
color: #dcdcdc;
font-size: 1rem;
text-transform: uppercase;
position: relative;
cursor: pointer;
caret-color: #8540ff;
}

.nav-links li {
list-style: none;
}

span{
flex:1 0 auto;
postion:relative;
text-align:right;
align-self:center;
}
.fa {
display: none;
color: #e9e9e9;
position: relative;
}
media only screen and (max-width: 760px) {

.nav-links{
display:none;
}

.toggle-link{
display:flex;
flex-direction:column;
position:absolute;
width:auto;
top: 63px;
padding: 20px;
background:white;
right:0;
}

.logo {
font-size: 1.8rem;
}

nav {
padding: 10px;
}
}

JS
function openSlideMenu(){
let link = document.getElementById("link")
console.log(link.classList.toggle("toggle-link"))
}
 
Status
Not open for further replies.

About this Thread

  • 8
    Replies
  • 354
    Views
  • 5
    Participants
Last reply from:
Equilibrium

Trending Topics

Online now

Members online
1,063
Guests online
2,105
Total visitors
3,168

Forum statistics

Threads
2,284,623
Posts
29,024,546
Members
1,220,051
Latest member
hookbalamu
Back
Top