Skip to content

Commit 3a2b5e8

Browse files
authored
Update default.html
1 parent 3d48215 commit 3a2b5e8

1 file changed

Lines changed: 36 additions & 23 deletions

File tree

‎_layouts/default.html‎

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@
8585
display: flex;
8686
justify-content: flex-end;
8787
align-items: center;
88-
gap: 10px;
88+
gap: 6px;
8989
position: relative;
9090
}
9191

92-
.nav-center a, .nav-center .dropbtn {
92+
.nav-center .nav-link {
9393
text-decoration: none;
9494
color: var(--text-muted);
9595
font-weight: 600;
@@ -102,12 +102,12 @@
102102
border: none;
103103
cursor: pointer;
104104
font-family: 'Inter', sans-serif;
105-
display: flex;
105+
display: inline-flex;
106106
align-items: center;
107107
gap: 5px;
108108
}
109109

110-
.nav-center a:hover, .nav-center .dropbtn:hover, .nav-center .dropdown:hover .dropbtn {
110+
.nav-center .nav-link:hover, .nav-center .dropdown:hover > .nav-link {
111111
color: var(--accent-blue);
112112
}
113113

@@ -122,6 +122,7 @@
122122
transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
123123
z-index: 1;
124124
box-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
125+
pointer-events: none;
125126
}
126127

127128
/* DROPDOWN APPS */
@@ -340,14 +341,14 @@
340341
</div>
341342
<div class="nav-center" id="navCenter">
342343
<div class="nav-indicator" id="navIndicator"></div>
343-
<a href="/" class="nav-item nav-link {% if page.url == '/' %}active-page{% endif %}">Hub</a>
344-
<a href="/newsy" class="nav-item nav-link {% if page.url contains 'newsy' %}active-page{% endif %}">Newsy</a>
345-
<a href="/blog" class="nav-item nav-link {% if page.url contains 'blog' %}active-page{% endif %}">Blog</a>
346-
<a href="/homelab" class="nav-item nav-link {% if page.url contains 'homelab' %}active-page{% endif %}">HomeLab</a>
347-
<a href="/sponsors" class="nav-item nav-link {% if page.url contains 'sponsors' %}active-page{% endif %}">Sponsors</a>
344+
<a href="/" class="nav-link {% if page.url == '/' %}active-page{% endif %}">Hub</a>
345+
<a href="/newsy" class="nav-link {% if page.url contains 'newsy' %}active-page{% endif %}">Newsy</a>
346+
<a href="/blog" class="nav-link {% if page.url contains 'blog' %}active-page{% endif %}">Blog</a>
347+
<a href="/homelab" class="nav-link {% if page.url contains 'homelab' %}active-page{% endif %}">HomeLab</a>
348+
<a href="/sponsors" class="nav-link {% if page.url contains 'sponsors' %}active-page{% endif %}">Sponsors</a>
348349

349-
<div class="dropdown nav-item nav-link">
350-
<button class="dropbtn">Apps ▾</button>
350+
<div class="dropdown nav-link" style="padding: 0;">
351+
<a href="#" class="nav-link dropbtn" onclick="return false;">Apps ▾</a>
351352
<div class="dropdown-content">
352353
<div class="dropdown-links-wrapper">
353354
<a href="/orbit">Orbit <span>↗</span></a>
@@ -362,8 +363,8 @@
362363
</div>
363364
</div>
364365

365-
<a href="/benchmarks" class="nav-item nav-link {% if page.url contains 'benchmarks' %}active-page{% endif %}">Benchmarks</a>
366-
<a href="/kontakt" class="nav-item nav-link {% if page.url contains 'kontakt' %}active-page{% endif %}">Kontakt</a>
366+
<a href="/benchmarks" class="nav-link {% if page.url contains 'benchmarks' %}active-page{% endif %}">Benchmarks</a>
367+
<a href="/kontakt" class="nav-link {% if page.url contains 'kontakt' %}active-page{% endif %}">Kontakt</a>
367368
</div>
368369
</nav>
369370

@@ -456,30 +457,42 @@ <h4>Follow DevLabStudy</h4>
456457
<script>
457458
const navCenter = document.getElementById('navCenter');
458459
const indicator = document.getElementById('navIndicator');
459-
const navItems = navCenter.querySelectorAll('.nav-item');
460-
const activeItem = navCenter.querySelector('.active-page') || navItems[0];
460+
const navLinks = navCenter.querySelectorAll(':scope > .nav-link');
461+
const activeLink = navCenter.querySelector('.active-page') || navLinks[0];
461462

462463
function moveIndicator(el) {
463464
if (!el) return;
464465
indicator.style.width = el.offsetWidth + 'px';
465466
indicator.style.left = el.offsetLeft + 'px';
466467
}
467468

468-
moveIndicator(activeItem);
469+
const savedLeft = sessionStorage.getItem('nav_indicator_left');
470+
const savedWidth = sessionStorage.getItem('nav_indicator_width');
471+
472+
if (savedLeft !== null && savedWidth !== null) {
473+
indicator.style.transition = 'none';
474+
indicator.style.left = savedLeft;
475+
indicator.style.width = savedWidth;
476+
void indicator.offsetHeight;
477+
indicator.style.transition = '';
478+
moveIndicator(activeLink);
479+
} else {
480+
moveIndicator(activeLink);
481+
}
469482

470-
navItems.forEach(item => {
471-
item.addEventListener('click', () => {
472-
sessionStorage.setItem('nav_indicator_left', item.offsetLeft + 'px');
473-
sessionStorage.setItem('nav_indicator_width', item.offsetWidth + 'px');
483+
navLinks.forEach(link => {
484+
link.addEventListener('click', () => {
485+
sessionStorage.setItem('nav_indicator_left', link.offsetLeft + 'px');
486+
sessionStorage.setItem('nav_indicator_width', link.offsetWidth + 'px');
474487
});
475488

476-
item.addEventListener('mouseenter', () => {
477-
moveIndicator(item);
489+
link.addEventListener('mouseenter', () => {
490+
moveIndicator(link);
478491
});
479492
});
480493

481494
navCenter.addEventListener('mouseleave', () => {
482-
moveIndicator(activeItem);
495+
moveIndicator(activeLink);
483496
});
484497
</script>
485498
</body>

0 commit comments

Comments
 (0)