vlcsolutions commited on
Commit
3afcf2f
·
verified ·
1 Parent(s): d174bee

Mobile menu is not working correct it

Browse files
Files changed (2) hide show
  1. index.html +19 -8
  2. style.css +13 -3
index.html CHANGED
@@ -256,10 +256,9 @@ class="inline-flex items-center text-[#002060] hover:text-[#8DC63F] px-3 py-2 te
256
  <i data-feather="menu"></i>
257
  </button>
258
  </div>
259
-
260
  <!-- Mobile Menu -->
261
- <div id="mobile-menu" class="md:hidden hidden absolute top-full left-0 right-0 bg-white shadow-lg z-50">
262
- <div class="px-2 pt-2 pb-3 space-y-1 sm:px-3">
263
  <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>
264
 
265
  <!-- Solutions Dropdown -->
@@ -671,28 +670,40 @@ class="inline-flex items-center text-[#002060] hover:text-[#8DC63F] px-3 py-2 te
671
  if (window.feather) {
672
  feather.replace();
673
  }
674
-
675
  // --- Mobile menu toggle ---
676
  const mobileMenuButton = document.getElementById('mobile-menu-button');
677
  const mobileMenu = document.getElementById('mobile-menu');
678
 
679
  if (mobileMenuButton && mobileMenu) {
680
  mobileMenuButton.addEventListener('click', () => {
681
- mobileMenu.classList.toggle('hidden');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
682
 
683
  // Toggle icon between menu and x
684
  const icon = mobileMenuButton.querySelector('[data-feather]');
685
  if (icon && window.feather) {
686
  icon.setAttribute(
687
  'data-feather',
688
- mobileMenu.classList.contains('hidden') ? 'menu' : 'x'
689
  );
690
  feather.replace();
691
  }
692
  });
693
  }
694
-
695
- // --- Mobile dropdown toggles (exposed globally) ---
696
  window.toggleMobileDropdown = function (id) {
697
  const dropdown = document.getElementById(id);
698
  if (!dropdown) return;
 
256
  <i data-feather="menu"></i>
257
  </button>
258
  </div>
 
259
  <!-- Mobile Menu -->
260
+ <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 transform -translate-y-2 opacity-0">
261
+ <div class="px-2 pt-2 pb-3 space-y-1 sm:px-3">
262
  <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>
263
 
264
  <!-- Solutions Dropdown -->
 
670
  if (window.feather) {
671
  feather.replace();
672
  }
 
673
  // --- Mobile menu toggle ---
674
  const mobileMenuButton = document.getElementById('mobile-menu-button');
675
  const mobileMenu = document.getElementById('mobile-menu');
676
 
677
  if (mobileMenuButton && mobileMenu) {
678
  mobileMenuButton.addEventListener('click', () => {
679
+ const isHidden = mobileMenu.classList.contains('hidden');
680
+
681
+ if (isHidden) {
682
+ mobileMenu.classList.remove('hidden');
683
+ setTimeout(() => {
684
+ mobileMenu.classList.remove('-translate-y-2');
685
+ mobileMenu.classList.remove('opacity-0');
686
+ }, 10);
687
+ } else {
688
+ mobileMenu.classList.add('-translate-y-2');
689
+ mobileMenu.classList.add('opacity-0');
690
+ setTimeout(() => {
691
+ mobileMenu.classList.add('hidden');
692
+ }, 300);
693
+ }
694
 
695
  // Toggle icon between menu and x
696
  const icon = mobileMenuButton.querySelector('[data-feather]');
697
  if (icon && window.feather) {
698
  icon.setAttribute(
699
  'data-feather',
700
+ isHidden ? 'x' : 'menu'
701
  );
702
  feather.replace();
703
  }
704
  });
705
  }
706
+ // --- Mobile dropdown toggles (exposed globally) ---
 
707
  window.toggleMobileDropdown = function (id) {
708
  const dropdown = document.getElementById(id);
709
  if (!dropdown) return;
style.css CHANGED
@@ -1,8 +1,18 @@
1
- body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
 
 
 
4
  }
5
 
 
 
 
 
6
  h1 {
7
  font-size: 16px;
8
  margin-top: 0;
 
1
+
2
+ /* Mobile menu animations */
3
+ #mobile-menu {
4
+ transition: transform 0.3s ease, opacity 0.3s ease;
5
+ }
6
+
7
+ #mobile-menu:not(.hidden) {
8
+ transform: translateY(0);
9
+ opacity: 1;
10
  }
11
 
12
+ body {
13
+ padding: 2rem;
14
+ font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
15
+ }
16
  h1 {
17
  font-size: 16px;
18
  margin-top: 0;