diff --git a/default.hbs b/default.hbs index 1bef72b..8a2bf0e 100644 --- a/default.hbs +++ b/default.hbs @@ -5,6 +5,7 @@ mobileMenuOpen: false, currentPath: window.location.pathname, showScrollTop: false, + isSticky: false, init() { $watch('theme', val => { localStorage.setItem('theme', val); @@ -13,9 +14,10 @@ document.documentElement.setAttribute('data-theme', this.theme); document.documentElement.classList.remove('hidden'); - // Handle scroll for scroll-to-top button + // Handle scroll for sticky header and scroll-to-top button window.addEventListener('scroll', () => { this.showScrollTop = window.scrollY > 400; + this.isSticky = window.scrollY > 50; }); // Update currentPath on navigation to keep menu highlights in sync diff --git a/partials/header.hbs b/partials/header.hbs index 63c0ab4..171842d 100644 --- a/partials/header.hbs +++ b/partials/header.hbs @@ -1,10 +1,14 @@ -
-
+
+