Update BasicScripts.astro
fix typo
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user