|
30 | 30 | </div> |
31 | 31 | </div> |
32 | 32 | {%- else -%} |
33 | | - <a class="inline-block px-4 py-2 text-gray-600 no-underline font-medium transition-all duration-200 hover:text-blue-600 hover:bg-gray-50 rounded-md whitespace-nowrap" href="{{ item.url | relative_url }}">{{ item.title | escape }}</a> |
| 33 | + {%- if item.button_style == "solid" -%} |
| 34 | + <a class="inline-block px-4 py-2 text-white !text-white no-underline font-medium transition-all duration-200 bg-blue-600 hover:bg-blue-700 rounded-md whitespace-nowrap" href="{{ item.url | relative_url }}">{{ item.title | escape }}</a> |
| 35 | + {%- else -%} |
| 36 | + <a class="inline-block px-4 py-2 text-gray-600 no-underline font-medium transition-all duration-200 hover:text-blue-600 hover:bg-gray-50 rounded-md whitespace-nowrap" href="{{ item.url | relative_url }}">{{ item.title | escape }}</a> |
| 37 | + {%- endif -%} |
34 | 38 | {%- endif -%} |
35 | 39 | {%- endfor -%} |
36 | 40 | </nav> |
|
71 | 75 | </div> |
72 | 76 | </div> |
73 | 77 | {%- else -%} |
74 | | - <a class="block px-4 py-3 text-gray-700 no-underline font-medium active:text-blue-600 active:bg-blue-50 focus:text-blue-600 focus:bg-gray-50 rounded-md transition-all duration-200 touch-manipulation" href="{{ item.url | relative_url }}">{{ item.title | escape }}</a> |
| 78 | + {%- if item.button_style == "solid" -%} |
| 79 | + <a class="block px-4 py-3 text-white !text-white no-underline font-medium active:text-white active:bg-blue-700 focus:text-white focus:bg-blue-700 bg-blue-600 rounded-md transition-all duration-200 touch-manipulation" href="{{ item.url | relative_url }}">{{ item.title | escape }}</a> |
| 80 | + {%- else -%} |
| 81 | + <a class="block px-4 py-3 text-gray-700 no-underline font-medium active:text-blue-600 active:bg-blue-50 focus:text-blue-600 focus:bg-gray-50 rounded-md transition-all duration-200 touch-manipulation" href="{{ item.url | relative_url }}">{{ item.title | escape }}</a> |
| 82 | + {%- endif -%} |
75 | 83 | {%- endif -%} |
76 | 84 | {%- endfor -%} |
77 | 85 | </div> |
|
100 | 108 | transform: rotate(180deg); |
101 | 109 | } |
102 | 110 |
|
| 111 | +/* Hover effects for desktop dropdowns */ |
| 112 | +@media (min-width: 768px) { |
| 113 | + .dropdown-container:hover .dropdown-menu { |
| 114 | + display: block !important; |
| 115 | + opacity: 1 !important; |
| 116 | + visibility: visible !important; |
| 117 | + transform: translateY(0) !important; |
| 118 | + pointer-events: auto !important; |
| 119 | + } |
| 120 | + |
| 121 | + .dropdown-container:hover .dropdown-toggle svg { |
| 122 | + transform: rotate(180deg); |
| 123 | + } |
| 124 | + |
| 125 | + /* Ensure dropdown stays open when hovering over the menu */ |
| 126 | + .dropdown-menu:hover { |
| 127 | + display: block !important; |
| 128 | + opacity: 1 !important; |
| 129 | + visibility: visible !important; |
| 130 | + transform: translateY(0) !important; |
| 131 | + pointer-events: auto !important; |
| 132 | + } |
| 133 | +} |
| 134 | + |
103 | 135 | /* Mobile menu styles */ |
104 | 136 | #mobile-menu { |
105 | 137 | opacity: 0; |
|
148 | 180 | color: #2563eb !important; /* text-blue-600 */ |
149 | 181 | } |
150 | 182 |
|
| 183 | +/* Ensure solid button style keeps white text even when visited */ |
| 184 | +#nav-menu a.bg-blue-600:visited, |
| 185 | +#mobile-menu a.bg-blue-600:visited { |
| 186 | + color: white !important; |
| 187 | +} |
| 188 | + |
| 189 | +/* Light blue text on hover for solid buttons */ |
| 190 | +#nav-menu a.bg-blue-600:hover, |
| 191 | +#nav-menu a.bg-blue-600:hover:visited, |
| 192 | +#mobile-menu a.bg-blue-600:hover, |
| 193 | +#mobile-menu a.bg-blue-600:hover:visited { |
| 194 | + color: #93c5fd !important; /* text-blue-300 */ |
| 195 | +} |
| 196 | + |
151 | 197 | /* Smooth transitions for all interactive elements */ |
152 | 198 | * { |
153 | 199 | transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; |
|
213 | 259 | }); |
214 | 260 | } |
215 | 261 |
|
216 | | - // Handle desktop dropdown toggle clicks |
| 262 | + // Handle desktop dropdown toggle clicks and hover |
217 | 263 | dropdownContainers.forEach(container => { |
218 | 264 | const toggle = container.querySelector('.dropdown-toggle'); |
219 | 265 | const menu = container.querySelector('.dropdown-menu'); |
220 | 266 |
|
221 | 267 | console.log('Setting up desktop dropdown:', toggle.textContent.trim()); |
222 | 268 |
|
| 269 | + // Click handler for desktop dropdowns |
223 | 270 | toggle.addEventListener('click', function(e) { |
224 | 271 | e.preventDefault(); |
225 | 272 | e.stopPropagation(); |
|
240 | 287 | console.log('Desktop dropdown opened:', toggle.textContent.trim()); |
241 | 288 | } |
242 | 289 | }); |
| 290 | + |
| 291 | + // Hover handlers for desktop dropdowns |
| 292 | + if (window.innerWidth >= 768) { |
| 293 | + container.addEventListener('mouseenter', function() { |
| 294 | + // Close other dropdowns when hovering over a new one |
| 295 | + closeAllDropdowns(); |
| 296 | + toggle.classList.add('active'); |
| 297 | + menu.classList.add('active'); |
| 298 | + }); |
| 299 | + |
| 300 | + container.addEventListener('mouseleave', function() { |
| 301 | + // Small delay to allow moving mouse to dropdown menu |
| 302 | + setTimeout(() => { |
| 303 | + if (!container.matches(':hover') && !menu.matches(':hover')) { |
| 304 | + toggle.classList.remove('active'); |
| 305 | + menu.classList.remove('active'); |
| 306 | + } |
| 307 | + }, 100); |
| 308 | + }); |
| 309 | + |
| 310 | + menu.addEventListener('mouseleave', function() { |
| 311 | + toggle.classList.remove('active'); |
| 312 | + menu.classList.remove('active'); |
| 313 | + }); |
| 314 | + } |
243 | 315 | }); |
244 | 316 |
|
245 | 317 | // Handle mobile dropdown toggle clicks |
|
302 | 374 | closeIcon.classList.add('hidden'); |
303 | 375 | closeAllMobileDropdowns(); |
304 | 376 | } |
| 377 | + // Close all dropdowns on resize to prevent hover issues |
| 378 | + closeAllDropdowns(); |
| 379 | + } else { |
| 380 | + // On mobile, ensure all dropdowns are closed |
| 381 | + closeAllDropdowns(); |
305 | 382 | } |
306 | 383 | }); |
307 | 384 | }); |
|
0 commit comments