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

Fixed the hamburger icon for home page #1915

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions assets/commonscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const updateProgress = () => {
document.addEventListener('scroll', updateProgress);

// Toggle mobile menu visibility
const hamBurger = document.querySelector(".hamburger");
const nMenu = document.querySelector(".nav-menu");
const hamburger = document.querySelector(".hamburger");
const navMenu = document.querySelector(".nav-menu");

document.addEventListener("DOMContentLoaded", function () {
setTimeout(function () {
Expand All @@ -20,11 +20,19 @@ document.addEventListener("DOMContentLoaded", function () {
});

// Hamburger menu
hamBurger.addEventListener("click", mobileMenu);
hamburger.addEventListener("click", mobileMenu);

function mobileMenu() {
hamBurger.classList.toggle("active");
nMenu.classList.toggle("active");
hamburger.classList.toggle("active");
navMenu.classList.toggle("active");
}

const navLink = document.querySelectorAll(".nav-link");
navLink.forEach(n => n.addEventListener("click", closeMenu));

function closeMenu() {
hamburger.classList.remove("active");
navMenu.classList.remove("active");
}

// Hide or show scroll progress indicator
Expand Down
26 changes: 0 additions & 26 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,6 @@ window.addEventListener('scroll', () => {
});
});

// Toggle mobile menu visibility
const hamburger = document.querySelector(".hamburger");
const navMenu = document.querySelector(".nav-menu");

document.addEventListener("DOMContentLoaded", function () {
setTimeout(function () {
document.querySelector("body").classList.add("loaded");
}, 500);
});

// Hamburger menu
hamburger.addEventListener("click", mobileMenu);

function mobileMenu() {
hamburger.classList.toggle("active");
navMenu.classList.toggle("active");
}

const navLink = document.querySelectorAll(".nav-link");
navLink.forEach(n => n.addEventListener("click", closeMenu));

function closeMenu() {
hamburger.classList.remove("active");
navMenu.classList.remove("active");
}

// Google Translate
function googleTranslateElementInit() {
new google.translate.TranslateElement({
Expand Down
4 changes: 2 additions & 2 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2176,8 +2176,8 @@ footer {
}

.nav-item {
margin: 3.5rem 0;
font-size: 20px;
margin: 1.8rem 0;
font-size: 25px;
}

nav li:hover {
Expand Down
Loading