Update BasicScripts.astro

fix typo
This commit is contained in:
javayhu
2024-04-07 19:19:40 +08:00
committed by GitHub
parent 7d0d4a4f05
commit 5aa19dde45

View File

@@ -116,7 +116,7 @@ import { UI } from 'astrowind:config';
document.querySelector('#header > div > div:last-child')?.classList.add('hidden'); document.querySelector('#header > div > div:last-child')?.classList.add('hidden');
}); });
function appyHeaderStylesOnScroll() { function applyHeaderStylesOnScroll() {
const header = document.querySelector('#header[data-aw-sticky-header]'); const header = document.querySelector('#header[data-aw-sticky-header]');
if (lastKnownScrollPosition > 60 && !header.classList.contains('scroll')) { if (lastKnownScrollPosition > 60 && !header.classList.contains('scroll')) {
document.getElementById('header').classList.add('scroll'); document.getElementById('header').classList.add('scroll');
@@ -125,14 +125,14 @@ import { UI } from 'astrowind:config';
} }
ticking = false; ticking = false;
} }
appyHeaderStylesOnScroll(); applyHeaderStylesOnScroll();
attachEvent([document], 'scroll', function () { attachEvent([document], 'scroll', function () {
lastKnownScrollPosition = window.scrollY; lastKnownScrollPosition = window.scrollY;
if (!ticking) { if (!ticking) {
window.requestAnimationFrame(() => { window.requestAnimationFrame(() => {
appyHeaderStylesOnScroll(); applyHeaderStylesOnScroll();
}); });
ticking = true; ticking = true;
} }