vlcsolutions commited on
Commit
12f7152
·
verified ·
1 Parent(s): 936d6af

Mobile Menu : not working

Browse files
Files changed (2) hide show
  1. index.html +64 -50
  2. style.css +23 -7
index.html CHANGED
@@ -1361,68 +1361,82 @@ 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
-
1384
- // Mobile menu toggle functionality
1385
- const mobileMenuButton = document.getElementById('mobile-menu-button');
1386
- const mobileMenu = document.getElementById('mobile-menu');
1387
-
1388
- if (mobileMenuButton && mobileMenu) {
1389
- mobileMenuButton.addEventListener('click', () => {
1390
- // Toggle the mobile menu visibility
1391
- mobileMenu.classList.toggle('hidden');
1392
-
1393
- // Change icon from menu to close (or vice versa)
1394
- const icon = mobileMenuButton.querySelector('i');
1395
- if (mobileMenu.classList.contains('hidden')) {
1396
- feather.icons.menu.replace(); // Show menu icon
1397
- } else {
1398
- feather.icons.x.replace(); // Show close (X) icon
1399
- }
1400
- });
1401
- }
1402
 
1403
- // Function to toggle mobile dropdowns
1404
- window.toggleMobileDropdown = function(id) {
1405
- const dropdown = document.getElementById(id);
1406
- dropdown.classList.toggle('hidden');
1407
 
1408
- // Update chevron icon
1409
- const button = dropdown.previousElementSibling;
1410
- const icon = button.querySelector('i');
1411
- if (dropdown.classList.contains('hidden')) {
1412
- feather.icons['chevron-down'].replace(); // Show down arrow
 
 
 
 
 
 
 
 
1413
  } else {
1414
- feather.icons['chevron-up'].replace(); // Show up arrow
1415
  }
1416
- };
 
 
1417
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1418
  });
1419
 
1420
- // Refresh AOS on window resize (guard if AOS is present)
1421
  window.addEventListener('resize', function() {
1422
  if (window.AOS && AOS.refreshHard) {
1423
  AOS.refreshHard();
1424
  }
1425
  });
 
1426
  </script>
1427
  </body>
1428
  </html>
 
1361
  </div>
1362
  </div>
1363
  </footer>
1364
+ <script>
1365
+ document.addEventListener('DOMContentLoaded', function() {
1366
+ // Initialize AOS
1367
+ if (window.AOS) {
1368
+ AOS.init({
1369
+ duration: 800,
1370
+ easing: 'ease-in-out',
1371
+ once: true,
1372
+ mirror: false,
1373
+ offset: 120,
1374
+ disable: window.innerWidth < 768
1375
+ });
1376
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1377
 
1378
+ // Replace Feather icons
1379
+ if (window.feather) {
1380
+ feather.replace();
1381
+ }
1382
 
1383
+ // Mobile menu 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', function() {
1389
+ const isExpanded = mobileMenu.classList.toggle('hidden');
1390
+ mobileMenuButton.setAttribute('aria-expanded', !isExpanded);
1391
+
1392
+ // Change icon
1393
+ const icon = mobileMenuButton.querySelector('i');
1394
+ if (isExpanded) {
1395
+ icon.setAttribute('data-feather', 'menu');
1396
  } else {
1397
+ icon.setAttribute('data-feather', 'x');
1398
  }
1399
+ feather.replace();
1400
+ });
1401
+ }
1402
 
1403
+ // Toggle dropdown functionality
1404
+ window.toggleMobileDropdown = function(id) {
1405
+ const dropdown = document.getElementById(id);
1406
+ const isExpanded = dropdown.classList.toggle('hidden');
1407
+
1408
+ // Find the button and icon
1409
+ const button = dropdown.previousElementSibling;
1410
+ const icon = button.querySelector('i');
1411
+
1412
+ if (isExpanded) {
1413
+ icon.setAttribute('data-feather', 'chevron-down');
1414
+ } else {
1415
+ icon.setAttribute('data-feather', 'chevron-up');
1416
+ }
1417
+ feather.replace();
1418
+ };
1419
+
1420
+ // Close menu when clicking outside
1421
+ document.addEventListener('click', function(event) {
1422
+ if (!mobileMenu.classList.contains('hidden') &&
1423
+ !mobileMenu.contains(event.target) &&
1424
+ event.target !== mobileMenuButton &&
1425
+ !mobileMenuButton.contains(event.target)) {
1426
+ mobileMenu.classList.add('hidden');
1427
+ mobileMenuButton.querySelector('i').setAttribute('data-feather', 'menu');
1428
+ mobileMenuButton.setAttribute('aria-expanded', 'false');
1429
+ feather.replace();
1430
+ }
1431
  });
1432
 
1433
+ // AOS refresh on resize
1434
  window.addEventListener('resize', function() {
1435
  if (window.AOS && AOS.refreshHard) {
1436
  AOS.refreshHard();
1437
  }
1438
  });
1439
+ });
1440
  </script>
1441
  </body>
1442
  </html>
style.css CHANGED
@@ -24,6 +24,13 @@ p {
24
  /* Mobile menu styles */
25
  #mobile-menu {
26
  transition: all 0.3s ease;
 
 
 
 
 
 
 
27
  max-height: 0;
28
  overflow: hidden;
29
  }
@@ -39,27 +46,25 @@ p {
39
  overflow: hidden;
40
  transition: max-height 0.3s ease;
41
  padding-left: 1rem;
 
42
  }
43
 
44
  #mobile-menu [id$="-dropdown"]:not(.hidden) {
45
  max-height: 1000px;
46
  }
47
 
48
- /* Mobile menu content */
49
- #mobile-menu-content {
50
- padding: 1rem;
51
- }
52
-
53
  /* Mobile menu links */
54
  #mobile-menu a {
55
  display: block;
56
  padding: 0.75rem 1rem;
 
57
  border-radius: 0.375rem;
58
  transition: background-color 0.2s;
59
  }
60
 
61
  #mobile-menu a:hover {
62
- background-color: rgba(255, 255, 255, 0.1);
 
63
  }
64
 
65
  /* Dropdown buttons */
@@ -67,12 +72,23 @@ p {
67
  width: 100%;
68
  text-align: left;
69
  padding: 0.75rem 1rem;
 
70
  border-radius: 0.375rem;
71
  transition: background-color 0.2s;
 
 
 
72
  }
73
 
74
  #mobile-menu button[onclick^="toggleMobileDropdown"]:hover {
75
- background-color: rgba(255, 255, 255, 0.1);
 
 
 
 
 
 
 
76
  }
77
  .card p:last-child {
78
  margin-bottom: 0;
 
24
  /* Mobile menu styles */
25
  #mobile-menu {
26
  transition: all 0.3s ease;
27
+ position: absolute;
28
+ top: 100%;
29
+ left: 0;
30
+ right: 0;
31
+ background: white;
32
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
33
+ z-index: 50;
34
  max-height: 0;
35
  overflow: hidden;
36
  }
 
46
  overflow: hidden;
47
  transition: max-height 0.3s ease;
48
  padding-left: 1rem;
49
+ background-color: #f9fafb;
50
  }
51
 
52
  #mobile-menu [id$="-dropdown"]:not(.hidden) {
53
  max-height: 1000px;
54
  }
55
 
 
 
 
 
 
56
  /* Mobile menu links */
57
  #mobile-menu a {
58
  display: block;
59
  padding: 0.75rem 1rem;
60
+ color: #374151;
61
  border-radius: 0.375rem;
62
  transition: background-color 0.2s;
63
  }
64
 
65
  #mobile-menu a:hover {
66
+ background-color: #f3f4f6;
67
+ color: #1f2937;
68
  }
69
 
70
  /* Dropdown buttons */
 
72
  width: 100%;
73
  text-align: left;
74
  padding: 0.75rem 1rem;
75
+ color: #374151;
76
  border-radius: 0.375rem;
77
  transition: background-color 0.2s;
78
+ display: flex;
79
+ justify-content: space-between;
80
+ align-items: center;
81
  }
82
 
83
  #mobile-menu button[onclick^="toggleMobileDropdown"]:hover {
84
+ background-color: #f3f4f6;
85
+ color: #1f2937;
86
+ }
87
+
88
+ /* CTA button in mobile menu */
89
+ #mobile-menu .bg-\\[\\#002060\\] {
90
+ margin: 1rem;
91
+ text-align: center;
92
  }
93
  .card p:last-child {
94
  margin-bottom: 0;