-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
140 additions
and
80 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
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,42 +1,49 @@ | ||
window.addEventListener("load", () => { | ||
// Variables for dropdown menu and mobile overlay | ||
let overlay = document.querySelector(".overlay"); | ||
let closeMenu = document.querySelector(".close-icon-btn"); | ||
let dropDownMenu = document.querySelectorAll(".dropdown"); | ||
let dropDownIcon = document.querySelectorAll(".dropdown-icon"); | ||
let droptDownMenuItems = document.querySelectorAll(".dropdown-menu"); | ||
let mobileIcon = document.querySelector(".navbar-toggler"); | ||
let mainMenu = document.querySelector(".main-menu"); | ||
let login = document.querySelector(".login"); | ||
|
||
// Variables for dropdown menu and mobile overlay | ||
let overlay = document.querySelector('.overlay'); | ||
let closeMenu = document.querySelector('.close-icon-btn'); | ||
let dropDownMenu = document.querySelectorAll('.dropdown'); | ||
let dropDownIcon = document.querySelectorAll('.dropdown-icon'); | ||
let mobileIcon = document.querySelector('.navbar-toggler'); | ||
let mainMenu = document.querySelector('.main-menu'); | ||
let login = document.querySelector('.login'); | ||
//Dropdown icon switch | ||
dropDownMenu.forEach((menu, index) => { | ||
menu.addEventListener("click", () => { | ||
console.log("clicked droped"); | ||
|
||
//Toggle the dropdown icon | ||
//Check if the dropdown icons on any index have icon arrow down | ||
if (dropDownIcon[index].src.includes("icon-arrow-down.svg")) { | ||
// If yes, change it to icon arrow up | ||
dropDownIcon[index].src = "./images/icon-arrow-up.svg"; | ||
} else { | ||
// else, add the arrow down if arrow up is not found. | ||
dropDownIcon[index].src = "./images/icon-arrow-down.svg"; | ||
} | ||
|
||
//Dropdown icon switch | ||
dropDownMenu.forEach((menu, index) => { | ||
menu.addEventListener('click', () => { | ||
console.log('clicked droped'); | ||
|
||
//Toggle the dropdown icon | ||
//Check if the dropdown icons on any index have icon arrow down | ||
if (dropDownIcon[index].src.includes("icon-arrow-down.svg")) { | ||
// If yes, change it to icon arrow up | ||
dropDownIcon[index].src = "./images/icon-arrow-up.svg"; | ||
} else { | ||
// else, add the arrow down if arrow up is not found. | ||
dropDownIcon[index].src = "./images/icon-arrow-down.svg"; | ||
} | ||
|
||
droptDownMenuItems.classList.add("dropdown-menu[data-bs-popper]"); | ||
}); | ||
}); | ||
}); | ||
|
||
//Overlay for mobile bn | ||
mobileIcon.addEventListener('click',()=>{ | ||
console.log('clicked'); | ||
overlay.classList.toggle('show'); | ||
}) | ||
// An event that will happend when the mobile icon is clicked, must show the mobile menu. | ||
mobileIcon.addEventListener("click", () => { | ||
console.log("clicked"); | ||
// adding the styles of overlay. | ||
overlay.classList.toggle("show"); | ||
}); | ||
|
||
closeMenu.addEventListener('click',()=> { | ||
console.log('clicked'); | ||
overlay.classList.remove('show'); | ||
mainMenu.classList.remove('show'); | ||
}) | ||
// An event that will happend when the close button is clicked, must hide the mobile menu. | ||
closeMenu.addEventListener("click", () => { | ||
console.log("clicked"); | ||
// remove the styles of overlay | ||
overlay.classList.remove("show"); | ||
// remove the styles for show and hide a menu. | ||
mainMenu.classList.remove("show"); | ||
}); | ||
|
||
//Initialising AOS js library | ||
AOS.init(); | ||
}); |
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
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
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
Oops, something went wrong.