feat: Refactor navbar and mobile menu into components for improved organization and maintainability

This commit is contained in:
zhangyuheng
2026-02-28 10:44:44 +08:00
parent 5772fc54c1
commit a3a972a2bc
9 changed files with 147 additions and 219 deletions

View File

@@ -13,29 +13,7 @@ document.addEventListener('DOMContentLoaded', () => {
});
function setupUI() {
// Mobile menu toggle
const toggle = document.getElementById('mobile-toggle');
const menu = document.getElementById('mobile-menu');
if (toggle && menu) {
const icon = toggle.querySelector('i');
toggle.addEventListener('click', () => {
menu.classList.toggle('active');
document.body.classList.toggle('menu-open');
if (menu.classList.contains('active')) {
if(icon) {
icon.classList.remove('fa-bars');
icon.classList.add('fa-times');
}
} else {
if(icon) {
icon.classList.remove('fa-times');
icon.classList.add('fa-bars');
}
}
});
}
// Mobile menu toggle handled by components.js
// Modal Logic
const modal = document.getElementById('sponsor-modal');