vlcsolutions commited on
Commit
0bf9f0d
·
verified ·
1 Parent(s): cad9c14

not working mobile menu, correct the mobile menu

Browse files
Files changed (2) hide show
  1. index.html +34 -45
  2. style.css +22 -6
index.html CHANGED
@@ -210,11 +210,10 @@ class="inline-flex items-center text-[#002060] hover:text-[#8DC63F] px-3 py-2 te
210
  <i data-feather="menu" class="w-6 h-6"></i>
211
  </button>
212
  </div>
213
-
214
- <!-- Mobile Menu -->
215
- <div id="mobile-menu" class="md:hidden hidden absolute top-full left-0 right-0 bg-white shadow-lg z-50 transition-all duration-300 ease-in-out">
216
- <div class="px-2 pt-2 pb-3 space-y-1 sm:px-3">
217
- <a href="./who-we-serve.html" class="block px-3 py-2 text-base font-medium text-gray-700 hover:text-[#8DC63F] hover:bg-gray-50">Who We Serve</a>
218
 
219
  <!-- Solutions Dropdown -->
220
  <div class="relative">
@@ -1361,54 +1360,37 @@ alt="Dynamics 365 Logistics Dashboard"
1361
  </div>
1362
  </div>
1363
  </footer>
1364
- <script>
1365
- // Init animations and handle mobile menu functionality after scripts loaded
1366
- document.addEventListener('DOMContentLoaded', () => {
1367
- // Initialize AOS (Animation On Scroll)
1368
- if (window.AOS) {
1369
- AOS.init({
1370
- duration: 800,
1371
- easing: 'ease-in-out',
1372
- once: true,
1373
- mirror: false,
1374
- offset: 120,
1375
- disable: window.innerWidth < 768
1376
- });
1377
- }
1378
-
1379
- // Replace Feather icons
1380
- if (window.feather) {
1381
- feather.replace();
1382
- }
1383
- // Mobile menu toggle functionality
1384
- const mobileMenuButton = document.getElementById('mobile-menu-button');
1385
  const mobileMenu = document.getElementById('mobile-menu');
1386
-
1387
- if (mobileMenuButton && mobileMenu) {
1388
- mobileMenuButton.addEventListener('click', () => {
1389
- const isExpanded = mobileMenuButton.getAttribute('aria-expanded') === 'true';
1390
- mobileMenuButton.setAttribute('aria-expanded', !isExpanded);
1391
- mobileMenu.classList.toggle('hidden');
1392
 
1393
  // Update icon
1394
- const icon = mobileMenuButton.querySelector('i');
1395
  icon.setAttribute('data-feather', isExpanded ? 'menu' : 'x');
1396
  feather.replace();
1397
  });
1398
 
1399
- // Close menu when clicking outside or on a link
1400
- document.addEventListener('click', (e) => {
1401
- if (!mobileMenu.contains(e.target) && e.target !== mobileMenuButton) {
1402
  mobileMenu.classList.add('hidden');
1403
- mobileMenuButton.setAttribute('aria-expanded', 'false');
1404
- const icon = mobileMenuButton.querySelector('i');
1405
  icon.setAttribute('data-feather', 'menu');
1406
  feather.replace();
1407
- }
1408
  });
1409
  }
1410
 
1411
- // Function to toggle mobile dropdowns
1412
  window.toggleMobileDropdown = function(id) {
1413
  const dropdown = document.getElementById(id);
1414
  const button = dropdown.previousElementSibling;
@@ -1418,13 +1400,20 @@ alt="Dynamics 365 Logistics Dashboard"
1418
  icon.setAttribute('data-feather', dropdown.classList.contains('hidden') ? 'chevron-down' : 'chevron-up');
1419
  feather.replace();
1420
  };
1421
- });
1422
 
1423
- // Refresh AOS on window resize (guard if AOS is present)
1424
- window.addEventListener('resize', function() {
1425
- if (window.AOS && AOS.refreshHard) {
1426
- AOS.refreshHard();
 
 
 
 
 
1427
  }
 
 
 
1428
  });
1429
  </script>
1430
  </body>
 
210
  <i data-feather="menu" class="w-6 h-6"></i>
211
  </button>
212
  </div>
213
+ <!-- Mobile Menu -->
214
+ <div id="mobile-menu" class="md:hidden hidden absolute top-16 left-0 right-0 bg-white shadow-lg z-50 transition-all duration-300 ease-in-out">
215
+ <div class="px-4 py-2 space-y-1">
216
+ <a href="./who-we-serve.html" class="block px-3 py-2 text-base font-medium text-gray-700 hover:text-[#8DC63F] hover:bg-gray-50">Who We Serve</a>
 
217
 
218
  <!-- Solutions Dropdown -->
219
  <div class="relative">
 
1360
  </div>
1361
  </div>
1362
  </footer>
1363
+ <script>
1364
+ // Mobile menu functionality
1365
+ document.addEventListener('DOMContentLoaded', function() {
1366
+ const mobileBtn = document.getElementById('mobile-menu-button');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1367
  const mobileMenu = document.getElementById('mobile-menu');
1368
+
1369
+ if (mobileBtn && mobileMenu) {
1370
+ // Toggle menu
1371
+ mobileBtn.addEventListener('click', function() {
1372
+ const isExpanded = mobileMenu.classList.toggle('hidden');
1373
+ mobileBtn.setAttribute('aria-expanded', !isExpanded);
1374
 
1375
  // Update icon
1376
+ const icon = mobileBtn.querySelector('i');
1377
  icon.setAttribute('data-feather', isExpanded ? 'menu' : 'x');
1378
  feather.replace();
1379
  });
1380
 
1381
+ // Close menu when clicking on a link
1382
+ mobileMenu.querySelectorAll('a').forEach(link => {
1383
+ link.addEventListener('click', () => {
1384
  mobileMenu.classList.add('hidden');
1385
+ mobileBtn.setAttribute('aria-expanded', 'false');
1386
+ const icon = mobileBtn.querySelector('i');
1387
  icon.setAttribute('data-feather', 'menu');
1388
  feather.replace();
1389
+ });
1390
  });
1391
  }
1392
 
1393
+ // Toggle dropdowns in mobile menu
1394
  window.toggleMobileDropdown = function(id) {
1395
  const dropdown = document.getElementById(id);
1396
  const button = dropdown.previousElementSibling;
 
1400
  icon.setAttribute('data-feather', dropdown.classList.contains('hidden') ? 'chevron-down' : 'chevron-up');
1401
  feather.replace();
1402
  };
 
1403
 
1404
+ // Initialize AOS if present
1405
+ if (window.AOS) {
1406
+ AOS.init({
1407
+ duration: 800,
1408
+ easing: 'ease-in-out',
1409
+ once: true,
1410
+ mirror: false
1411
+ });
1412
+ window.addEventListener('resize', () => AOS.refreshHard());
1413
  }
1414
+
1415
+ // Replace icons
1416
+ if (window.feather) feather.replace();
1417
  });
1418
  </script>
1419
  </body>
style.css CHANGED
@@ -21,18 +21,34 @@ p {
21
  border: 1px solid lightgray;
22
  border-radius: 16px;
23
  }
24
-
25
- /* Mobile menu transitions */
26
  #mobile-menu {
27
- transform: translateY(-10px);
 
 
28
  opacity: 0;
29
- visibility: hidden;
30
  }
31
 
32
  #mobile-menu:not(.hidden) {
33
- transform: translateY(0);
34
  opacity: 1;
35
- visibility: visible;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
37
  .card p:last-child {
38
  margin-bottom: 0;
 
21
  border: 1px solid lightgray;
22
  border-radius: 16px;
23
  }
24
+ /* Mobile menu styles */
 
25
  #mobile-menu {
26
+ transition: all 0.3s ease;
27
+ max-height: 0;
28
+ overflow: hidden;
29
  opacity: 0;
 
30
  }
31
 
32
  #mobile-menu:not(.hidden) {
33
+ max-height: 1000px;
34
  opacity: 1;
35
+ overflow-y: auto;
36
+ }
37
+
38
+ /* Dropdown styles */
39
+ #mobile-menu [id$="-dropdown"] {
40
+ max-height: 0;
41
+ overflow: hidden;
42
+ transition: max-height 0.3s ease;
43
+ }
44
+
45
+ #mobile-menu [id$="-dropdown"]:not(.hidden) {
46
+ max-height: 1000px;
47
+ }
48
+
49
+ /* Menu button styles */
50
+ #mobile-menu-button {
51
+ transition: all 0.3s ease;
52
  }
53
  .card p:last-child {
54
  margin-bottom: 0;