better css and responsiveness

This commit is contained in:
2026-01-07 20:05:32 +01:00
parent 6387d4a373
commit f4eb96c4ec
13 changed files with 537 additions and 131 deletions

View File

@@ -116,6 +116,56 @@ function setupDropdown() {
}
loadMeUI()
const mobileToggle = document.getElementById('mobile-menu-toggle');
const navCenter = document.querySelector('.nav-center');
let overlay = document.querySelector('.menu-overlay');
if (!overlay) {
overlay = document.createElement('div');
overlay.className = 'menu-overlay';
document.body.appendChild(overlay);
}
function toggleMenu() {
navCenter.classList.toggle('open');
overlay.classList.toggle('active');
const isOpen = navCenter.classList.contains('open');
mobileToggle.innerHTML = isOpen
? '<svg width="24" height="24" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/></svg>'
: '<svg width="24" height="24" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"/></svg>';
}
mobileToggle.addEventListener('click', toggleMenu);
overlay.addEventListener('click', () => {
if (navCenter.classList.contains('open')) toggleMenu();
});
navCenter.querySelectorAll('.nav-button').forEach(btn => {
btn.addEventListener('click', () => {
if (navCenter.classList.contains('open')) toggleMenu();
});
});
const searchWrapper = document.querySelector('.search-wrapper');
const searchInput = document.getElementById('search-input');
searchWrapper.addEventListener('click', (e) => {
if (window.innerWidth <= 768) {
searchWrapper.classList.add('active-mobile');
searchInput.focus();
}
});
// Cerrar el buscador si se hace clic fuera
document.addEventListener('click', (e) => {
if (!searchWrapper.contains(e.target)) {
searchWrapper.classList.remove('active-mobile');
}
});
const createRoomModal = new CreateRoomModal();
const createBtn = document.getElementById('nav-create-party');