You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
971 B
31 lines
971 B
const sidebar = document.getElementById('sidebar');
|
|
const content = document.getElementById('content');
|
|
const topbar = document.getElementById('topbar');
|
|
const toggleBtn = document.getElementById('toggleBtn');
|
|
const mobileBtn = document.getElementById('mobileBtn');
|
|
const overlay = document.getElementById('overlay');
|
|
|
|
// Desktop collapse
|
|
if (toggleBtn) {
|
|
toggleBtn.addEventListener('click', () => {
|
|
if (sidebar) sidebar.classList.toggle('collapsed');
|
|
if (content) content.classList.toggle('full');
|
|
if (topbar) topbar.classList.toggle('full');
|
|
});
|
|
}
|
|
|
|
// Mobile sidebar open
|
|
if (mobileBtn) {
|
|
mobileBtn.addEventListener('click', () => {
|
|
if (sidebar) sidebar.classList.add('mobile-show');
|
|
if (overlay) overlay.classList.add('show');
|
|
});
|
|
}
|
|
|
|
// 🔥 Click outside to close
|
|
if (overlay) {
|
|
overlay.addEventListener('click', () => {
|
|
if (sidebar) sidebar.classList.remove('mobile-show');
|
|
if (overlay) overlay.classList.remove('show');
|
|
});
|
|
}
|