-
Notifications
You must be signed in to change notification settings - Fork 431
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 #1522 from khushi-joshi-05/revert-1405-enhance_navbar
Revert "Enhance navbar"
- Loading branch information
Showing
5 changed files
with
126 additions
and
158 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
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,53 +1,40 @@ | ||
|
||
// Theme Toggle | ||
const themeToggleIcon = document.getElementById("theme-toggle-icon"); | ||
|
||
|
||
//Themechange icon toggling behaviour | ||
|
||
|
||
|
||
let themeToggleIcon = document.getElementById("theme-toggle-icon"); | ||
let themeToggleLogo = document.getElementById("theme-toggle-logo"); | ||
themeToggleIcon.addEventListener("click", function () { | ||
document.body.classList.toggle("dark-theme"); | ||
document.body.classList.toggle(":root") | ||
if (document.body.classList.contains("dark-theme")) { | ||
|
||
themeToggleIcon.src = "Images/navbar/sun.png"; | ||
themeToggleIcon.src = "../Images/navbar/sun.png"; | ||
themeToggleLogo.src = "Images/logo/Logo-Dark.png"; | ||
} else { | ||
themeToggleIcon.src = "Images/navbar/moon.png"; | ||
themeToggleIcon.src = "../Images/navbar/moon.png"; | ||
themeToggleLogo.src="Images/logo/Logo-Light.png"; | ||
} | ||
}); | ||
|
||
// Navbar Background Change on Scroll | ||
window.addEventListener("scroll", function () { | ||
const navbar = document.querySelector(".navbar"); | ||
if (window.scrollY > 100) { | ||
navbar.classList.add("scrolled"); | ||
} else { | ||
navbar.classList.remove("scrolled"); | ||
} | ||
}); | ||
//Services dropdown | ||
|
||
// Services dropdown | ||
const dropdownli = document.querySelector(".nav-item.dropdown"); | ||
const navlinka = document.querySelector('.nav-link.services'); | ||
const menu = document.querySelector('.dropdown .dropdown-menu'); | ||
|
||
dropdownli.addEventListener("mouseenter", () => { | ||
navlinka.classList.add("show"); | ||
menu.classList.add("show"); | ||
navlinka.setAttribute('aria-expanded', 'true'); | ||
menu.setAttribute("data-bs-popper", 'static'); | ||
navlinka.classList.add("show"); | ||
menu.classList.add("show"); | ||
navlinka.setAttribute('aria-expanded', 'true'); | ||
menu.setAttribute("data-bs-popper", 'static'); | ||
}); | ||
|
||
menu.addEventListener("mouseleave", () => { | ||
menu.classList.remove("show"); | ||
navlinka.classList.remove("show"); | ||
navlinka.setAttribute('aria-expanded', 'false'); | ||
menu.removeAttribute("data-bs-popper"); | ||
dropdownli.addEventListener("mouseleave", () => { | ||
menu.classList.remove("show"); | ||
navlinka.classList.remove("show"); | ||
navlinka.setAttribute('aria-expanded', 'false'); | ||
menu.removeAttribute("data-bs-popper"); | ||
}) | ||
dropdownli.addEventListener("mouseleave", () => { | ||
menu.classList.remove("show"); | ||
navlinka.classList.remove("show"); | ||
navlinka.setAttribute('aria-expanded', 'false'); | ||
menu.removeAttribute("data-bs-popper"); | ||
}) | ||
}); |
Oops, something went wrong.