web3district commited on
Commit
7cbdcfe
·
verified ·
1 Parent(s): afadbf1

Add click-outside functionality to close mobile menu

Browse files
Files changed (1) hide show
  1. index.html +13 -0
index.html CHANGED
@@ -1482,6 +1482,19 @@
1482
  };
1483
  });
1484
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1485
  // Filter chips
1486
  const filterChips = document.querySelectorAll('.filter-chip');
1487
  filterChips.forEach(chip => {
 
1482
  };
1483
  });
1484
 
1485
+ // Close mobile menu when clicking outside
1486
+ document.addEventListener('click', function(e) {
1487
+ const mobileMenu = document.getElementById('mobile-menu');
1488
+ const mobileMenuBtn = document.getElementById('mobile-menu-btn');
1489
+
1490
+ if (mobileMenu && mobileMenu.classList.contains('open')) {
1491
+ // Check if click is outside mobile menu and mobile menu button
1492
+ if (!mobileMenu.contains(e.target) && !mobileMenuBtn.contains(e.target)) {
1493
+ mobileMenu.classList.remove('open');
1494
+ }
1495
+ }
1496
+ });
1497
+
1498
  // Filter chips
1499
  const filterChips = document.querySelectorAll('.filter-chip');
1500
  filterChips.forEach(chip => {