Skip to content

Commit d5ca452

Browse files
devel
1 parent d978634 commit d5ca452

File tree

1 file changed

+80
-3
lines changed

1 file changed

+80
-3
lines changed

_includes/header.html

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@
3030
</div>
3131
</div>
3232
{%- 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 -%}
3438
{%- endif -%}
3539
{%- endfor -%}
3640
</nav>
@@ -71,7 +75,11 @@
7175
</div>
7276
</div>
7377
{%- 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 -%}
7583
{%- endif -%}
7684
{%- endfor -%}
7785
</div>
@@ -100,6 +108,30 @@
100108
transform: rotate(180deg);
101109
}
102110

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+
103135
/* Mobile menu styles */
104136
#mobile-menu {
105137
opacity: 0;
@@ -148,6 +180,20 @@
148180
color: #2563eb !important; /* text-blue-600 */
149181
}
150182

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+
151197
/* Smooth transitions for all interactive elements */
152198
* {
153199
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
@@ -213,13 +259,14 @@
213259
});
214260
}
215261

216-
// Handle desktop dropdown toggle clicks
262+
// Handle desktop dropdown toggle clicks and hover
217263
dropdownContainers.forEach(container => {
218264
const toggle = container.querySelector('.dropdown-toggle');
219265
const menu = container.querySelector('.dropdown-menu');
220266

221267
console.log('Setting up desktop dropdown:', toggle.textContent.trim());
222268

269+
// Click handler for desktop dropdowns
223270
toggle.addEventListener('click', function(e) {
224271
e.preventDefault();
225272
e.stopPropagation();
@@ -240,6 +287,31 @@
240287
console.log('Desktop dropdown opened:', toggle.textContent.trim());
241288
}
242289
});
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+
}
243315
});
244316

245317
// Handle mobile dropdown toggle clicks
@@ -302,6 +374,11 @@
302374
closeIcon.classList.add('hidden');
303375
closeAllMobileDropdowns();
304376
}
377+
// Close all dropdowns on resize to prevent hover issues
378+
closeAllDropdowns();
379+
} else {
380+
// On mobile, ensure all dropdowns are closed
381+
closeAllDropdowns();
305382
}
306383
});
307384
});

0 commit comments

Comments
 (0)