-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from demilade211/master
Added javascript functionality to navbar
- Loading branch information
Showing
3 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const burger = document.querySelector(".burger"); | ||
const nav = document.querySelector(".mobile-nav"); | ||
const navLink = document.querySelectorAll(".mobile-nav li"); | ||
const mobile = document.querySelectorAll(".m-link"); | ||
// fuction to toggle nav | ||
let state = 0; | ||
const openDrop=()=> { | ||
nav.style.display = "flex"; | ||
} | ||
const closeDrop=()=>{ | ||
nav.style.display = "none"; | ||
state = 0; | ||
} | ||
|
||
function toggleNav(n){ | ||
state += n; | ||
if(state==1){ | ||
openDrop(); | ||
} | ||
else{ | ||
closeDrop(); | ||
} | ||
|
||
// to animate nav | ||
navLink.forEach((link,index) => { | ||
if(link.style.animation){ // without the if statement the list fade in will only implent on refresh of the page | ||
link.style.animation = ""; | ||
} | ||
else{ | ||
link.style.animation = `navLinkFade 0.5s ease forwards ${index/7 + 0.5}s`; | ||
} | ||
}); | ||
// to animate the burger icon | ||
burger.classList.toggle("toggle"); | ||
} | ||
// to close mobile nav bar on click | ||
const closeDropdownMenuSelectingItem = (() => mobile.forEach((item) => item.addEventListener("click", ()=>{ | ||
closeDrop(); | ||
toggleNav(); | ||
})))() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,11 +33,19 @@ | |
<div><img src="img/ikeja branch NBA logo2 1.png" class="logo1" width="50px" height="40px"></div> | ||
<div><img src="img/ikeja branch NBA logo 1.png" class="logo2" width="140px" height="40px"></div> | ||
</div> | ||
<div class="burger"> | ||
<div class="burger" onclick="toggleNav(1)"> | ||
<div class="line1"></div> | ||
<div class="line2"></div> | ||
<div class="line3"></div> | ||
</div> | ||
<nav class="mobile-nav"> | ||
<ul> | ||
<li><a href="#" class="m-link">HOMES</a></li> | ||
<li><a href="#" class="m-link">NEWS & EVENTS</a></li> | ||
<li><a href="#" class="m-link">ABOUT US</a></li> | ||
<li><a href="#" class="m-link">MEMBERS PORTAL</a></li> | ||
</ul> | ||
</nav> | ||
<div class="nav-list"> | ||
<ul class="topnav"> | ||
<li class="active"> <a href="#">HOMES</a></li> | ||
|
@@ -227,6 +235,7 @@ <h6>Contact</h6> | |
<!-- Optional JavaScript; choose one of the two! --> | ||
|
||
<!-- Option 1: Bootstrap Bundle with Popper --> | ||
<script src="app.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.0-beta1/js/bootstrap.bundle.min.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/ionicons.js"></script> | ||
</body> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c957c11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nba2 – ./
nba2.vercel.app
nba2-git-master-omolola7991.vercel.app
nba2-omolola7991.vercel.app
c957c11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nba – ./
nba-cyan.vercel.app
nba-omolola7991.vercel.app
nba-git-master-omolola7991.vercel.app