Mobile Menu section : it's not working,correct it
Browse files- index.html +32 -6
- style.css +7 -4
index.html
CHANGED
|
@@ -211,8 +211,8 @@ class="inline-flex items-center text-[#002060] hover:text-[#8DC63F] px-3 py-2 te
|
|
| 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 -->
|
|
@@ -1365,29 +1365,50 @@ alt="Dynamics 365 Logistics Dashboard"
|
|
| 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 |
-
|
| 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
|
|
@@ -1398,6 +1419,12 @@ alt="Dynamics 365 Logistics Dashboard"
|
|
| 1398 |
|
| 1399 |
dropdown.classList.toggle('hidden');
|
| 1400 |
icon.setAttribute('data-feather', dropdown.classList.contains('hidden') ? 'chevron-down' : 'chevron-up');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1401 |
feather.replace();
|
| 1402 |
};
|
| 1403 |
|
|
@@ -1409,7 +1436,6 @@ alt="Dynamics 365 Logistics Dashboard"
|
|
| 1409 |
once: true,
|
| 1410 |
mirror: false
|
| 1411 |
});
|
| 1412 |
-
window.addEventListener('resize', () => AOS.refreshHard());
|
| 1413 |
}
|
| 1414 |
|
| 1415 |
// Replace icons
|
|
|
|
| 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 overflow-hidden">
|
| 215 |
+
<div class="px-4 py-2 space-y-1" id="mobile-menu-content">
|
| 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 -->
|
|
|
|
| 1365 |
document.addEventListener('DOMContentLoaded', function() {
|
| 1366 |
const mobileBtn = document.getElementById('mobile-menu-button');
|
| 1367 |
const mobileMenu = document.getElementById('mobile-menu');
|
| 1368 |
+
const mobileContent = document.getElementById('mobile-menu-content');
|
| 1369 |
|
| 1370 |
+
if (mobileBtn && mobileMenu && mobileContent) {
|
| 1371 |
// Toggle menu
|
| 1372 |
mobileBtn.addEventListener('click', function() {
|
| 1373 |
const isExpanded = mobileMenu.classList.toggle('hidden');
|
| 1374 |
mobileBtn.setAttribute('aria-expanded', !isExpanded);
|
| 1375 |
|
| 1376 |
+
// Update icon and manage overflow
|
| 1377 |
const icon = mobileBtn.querySelector('i');
|
| 1378 |
icon.setAttribute('data-feather', isExpanded ? 'menu' : 'x');
|
| 1379 |
+
|
| 1380 |
+
if (!isExpanded) {
|
| 1381 |
+
mobileMenu.style.maxHeight = mobileContent.scrollHeight + 'px';
|
| 1382 |
+
} else {
|
| 1383 |
+
mobileMenu.style.maxHeight = '0';
|
| 1384 |
+
}
|
| 1385 |
+
|
| 1386 |
feather.replace();
|
| 1387 |
});
|
| 1388 |
|
| 1389 |
// Close menu when clicking on a link
|
| 1390 |
+
mobileContent.querySelectorAll('a').forEach(link => {
|
| 1391 |
link.addEventListener('click', () => {
|
| 1392 |
mobileMenu.classList.add('hidden');
|
| 1393 |
+
mobileMenu.style.maxHeight = '0';
|
| 1394 |
mobileBtn.setAttribute('aria-expanded', 'false');
|
| 1395 |
const icon = mobileBtn.querySelector('i');
|
| 1396 |
icon.setAttribute('data-feather', 'menu');
|
| 1397 |
feather.replace();
|
| 1398 |
});
|
| 1399 |
});
|
| 1400 |
+
|
| 1401 |
+
// Handle window resize
|
| 1402 |
+
window.addEventListener('resize', function() {
|
| 1403 |
+
if (window.innerWidth > 768) {
|
| 1404 |
+
mobileMenu.classList.add('hidden');
|
| 1405 |
+
mobileMenu.style.maxHeight = '0';
|
| 1406 |
+
mobileBtn.setAttribute('aria-expanded', 'false');
|
| 1407 |
+
const icon = mobileBtn.querySelector('i');
|
| 1408 |
+
icon.setAttribute('data-feather', 'menu');
|
| 1409 |
+
feather.replace();
|
| 1410 |
+
}
|
| 1411 |
+
});
|
| 1412 |
}
|
| 1413 |
|
| 1414 |
// Toggle dropdowns in mobile menu
|
|
|
|
| 1419 |
|
| 1420 |
dropdown.classList.toggle('hidden');
|
| 1421 |
icon.setAttribute('data-feather', dropdown.classList.contains('hidden') ? 'chevron-down' : 'chevron-up');
|
| 1422 |
+
|
| 1423 |
+
// Update mobile menu height
|
| 1424 |
+
if (!mobileMenu.classList.contains('hidden')) {
|
| 1425 |
+
mobileMenu.style.maxHeight = mobileContent.scrollHeight + 'px';
|
| 1426 |
+
}
|
| 1427 |
+
|
| 1428 |
feather.replace();
|
| 1429 |
};
|
| 1430 |
|
|
|
|
| 1436 |
once: true,
|
| 1437 |
mirror: false
|
| 1438 |
});
|
|
|
|
| 1439 |
}
|
| 1440 |
|
| 1441 |
// Replace icons
|
style.css
CHANGED
|
@@ -23,15 +23,13 @@ p {
|
|
| 23 |
}
|
| 24 |
/* Mobile menu styles */
|
| 25 |
#mobile-menu {
|
| 26 |
-
transition:
|
| 27 |
max-height: 0;
|
| 28 |
overflow: hidden;
|
| 29 |
-
opacity: 0;
|
| 30 |
}
|
| 31 |
|
| 32 |
#mobile-menu:not(.hidden) {
|
| 33 |
-
max-height:
|
| 34 |
-
opacity: 1;
|
| 35 |
overflow-y: auto;
|
| 36 |
}
|
| 37 |
|
|
@@ -50,6 +48,11 @@ p {
|
|
| 50 |
#mobile-menu-button {
|
| 51 |
transition: all 0.3s ease;
|
| 52 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
.card p:last-child {
|
| 54 |
margin-bottom: 0;
|
| 55 |
}
|
|
|
|
| 23 |
}
|
| 24 |
/* Mobile menu styles */
|
| 25 |
#mobile-menu {
|
| 26 |
+
transition: max-height 0.3s ease-out;
|
| 27 |
max-height: 0;
|
| 28 |
overflow: hidden;
|
|
|
|
| 29 |
}
|
| 30 |
|
| 31 |
#mobile-menu:not(.hidden) {
|
| 32 |
+
max-height: 100vh;
|
|
|
|
| 33 |
overflow-y: auto;
|
| 34 |
}
|
| 35 |
|
|
|
|
| 48 |
#mobile-menu-button {
|
| 49 |
transition: all 0.3s ease;
|
| 50 |
}
|
| 51 |
+
|
| 52 |
+
/* Mobile menu content */
|
| 53 |
+
#mobile-menu-content {
|
| 54 |
+
padding: 1rem;
|
| 55 |
+
}
|
| 56 |
.card p:last-child {
|
| 57 |
margin-bottom: 0;
|
| 58 |
}
|