Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance navbar #1405

Merged
merged 11 commits into from
Jul 30, 2024
144 changes: 39 additions & 105 deletions Css-files/navbar.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* Variables */
/* General Styles */
:root {
/* General Colors */
--primary-bg-color: #ffffff;
--primary-text-color: #333335;
--secondary-bg-color: #f2f2f2;
Expand All @@ -10,14 +9,6 @@
--navbar-bg-color: #f2f2f2;
--navbar-hover-color: #e5e5e5;

/* Card Colors */
--card-bg-color: #ffffff;
--card-hover-color: #f5f5f5;

/* Footer Colors */
--footer-bg-color: #f2f2f2;
--footer-hover-color: #e5e5e5;

/* Additional Colors */
--container-bg: black;
--drop-bg: #212123;
Expand All @@ -27,29 +18,15 @@
}

.dark-theme {

--a: rgb(183, 175, 175);
--drop-bg: #ffffff;
--nav: white;
/* General Colors */
--primary-bg-color: #212123;
--primary-text-color: #ffffff;
--secondary-bg-color: #333335;
--accent-color: #9e5c48;

/* Navbar Colors */
--navbar-bg-color: #333335;
--navbar-hover-color: #474749;

/* Card Colors */
--card-bg-color: #2c2c2e;
--card-hover-color: #373739;

/* Footer Colors */
--footer-bg-color: #28282a;
--footer-hover-color: #333335;

/* Additional Colors */
--container-bg: rgb(224, 224, 252);
--drop-bg: #ffffff;
--a: black;
Expand Down Expand Up @@ -80,20 +57,22 @@
flex-grow: 0;
}


/* Navbar Links */
.nav-link {
transition: color 0.3s, background-color 0.3s;
position: relative;
color: var(--a);
text-shadow: 0 0 5px rgba(255,255,255, 0.75), 0 0 10px rgba(255,255,255, 0.75), 0 0 15px rgba(255,255,255, 0.75), 0 0 20px rgba(255,255,255, 0.75);
transition: color 0.3s, background-color 0.3s, text-shadow 0.3s;
}

.nav-link:hover {
color: #fff;
transform: scale(1.1);
border-radius: 5px;
text-shadow: 0 0 20px rgba(255, 165, 0, 1), 0 0 30px rgba(255, 165, 0, 1), 0 0 40px rgba(255, 165, 0, 1), 0 0 50px rgba(255, 165, 0, 1);
}

/* Center Links */

ul {
gap: 5px;
}
Expand All @@ -104,7 +83,6 @@ ul {
align-items: center;
}


.center-links .nav-item .nav-link:hover {
color: #f13800e4;
}
Expand Down Expand Up @@ -143,21 +121,20 @@ ul {
.navbar-nav.center-links .active {
color: #dc3545;
border-bottom: 2px solid #dc3545;
gap:10px;
gap: 10px;
}

.navbar-nav.end-links .active {
color: rgba(255, 183, 0, 0.705);
border-bottom: 2px solid rgba(255, 183, 0, 0.705);
gap:10px;
gap: 10px;
}



/* Dropdown Items */

#theme-toggle-icon {
width: 30px;
height:30px;
cursor: pointer;
}

Expand All @@ -173,92 +150,49 @@ ul {
padding: 4px 8px;
color: var(--a);
font-size: 15px;

background-color: var(--background-color);

transition: background-color 0.3s, transform 0.3s;

}

.dropdown-item:active {
background-color: #dc3545;
}

:root {
--background-color: #fff;
--text-color: #000;
--button-bg: #D0EEB0;
--button-hover-bg: #59a10c;
--card-bg: rgba(0, 0, 0, 0.8);
--carousel-caption-bg: rgba(0, 0, 0, 0.7);
}

body {
background-color: var(--background-color);
color: var(--text-color);
}

.section {
background-color: var(--background-color);
color: var(--text-color);
}

.btn-card {
background-color: var(--button-bg);
color: var(--text-color);
}

.card-1::after {
background-color: var(--button-hover-bg);
}

.card-1 {
background-color: var(--carousel-caption-bg);
}

/* Dark mode styles */
.about_us.dark-theme {
--background-color: #000;
--text-color: #fff;
--button-bg: #555;
--button-hover-bg: #333;
--card-bg: rgba(255, 255, 255, 0.8);
--carousel-caption-bg: rgba(255, 255, 255, 0.7);
}

.about_us.dark-theme {
background-color: var(--background-color);
color: var(--text-color);
}

.about_us.dark-theme .section {
background-color: var(--background-color);
color: var(--text-color);
}

.about_us.dark-theme .btn-card {
background-color: var(--button-bg);
color: var(--text-color);
}

.about_us.dark-theme .btn-card:hover {
background-color: var(--button-hover-bg);
}

.about_us.dark-theme .carousel-caption {
background-color: var(--carousel-caption-bg);
}


.dropdown-item:hover {
background-color: #007bff;
color: #fff;
transform: scale(1.1);
}

/* Theme Toggle Icon */
#theme-toggle-icon {
width: 30px;
cursor: pointer;
/* Bubbles Animation */
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url('https://cdn.pixabay.com/photo/2015/04/17/12/20/soap-bubble-726523_960_720.png') repeat;
z-index: -1;
animation: moveBubbles 30s linear infinite;
opacity: 0.5;
}

@keyframes moveBubbles {
0% {
transform: translateY(0);
}
100% {
transform: translateY(-1000px);
}
}

/* Additional Styles for Dark Theme */
.dark-theme .nav-link {
color: var(--a);
text-shadow: 0 0 5px rgba(0255, 255, 255, 0.75), 0 0 10px rgba(0255, 255, 255, 0.75), 0 0 15px rgba(0255, 255, 255, 0.75), 0 0 20px rgba(0255, 255, 255, 0.75);
}

.dark-theme .nav-link:hover {
text-shadow: 0 0 20px rgba(0, 255, 0, 1), 0 0 30px rgba(0, 255, 0, 1), 0 0 40px rgba(0, 255, 0, 1), 0 0 50px rgba(0, 255, 0, 1);
}
6 changes: 5 additions & 1 deletion Html-files/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@
<div class="collapse navbar-collapse hamburgeritems centerdiv order-2 order-lg-0">
<ul class="navbar-nav center-links">
<li class="nav-item">
<a class="nav-link" aria-current="page" href="index.html">

<a class="nav-link active" aria-current="page" href="../index.html">



<i class="fa-solid fa-home"></i> Home
</a>
</li>
Expand Down
49 changes: 31 additions & 18 deletions Html-files/navbar.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,53 @@

// 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";
themeToggleLogo.src = "Images/logo/Logo-Dark.png";

themeToggleIcon.src = "Images/navbar/sun.png";
} else {
themeToggleIcon.src = "../Images/navbar/moon.png";
themeToggleLogo.src="Images/logo/Logo-Light.png";
themeToggleIcon.src = "Images/navbar/moon.png";
}
});

//Services dropdown
// 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
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");
})
})
});
Loading
Loading