mirror of
https://github.com/kogakure/website-11ty-kogakure.de.git
synced 2026-02-03 20:25:30 +00:00
refactor: convert files from spaces to tabs
This commit is contained in:
@@ -1,27 +1,24 @@
|
||||
export function scrollHandler() {
|
||||
const body = document.body;
|
||||
const scrollUp = 'scroll-up';
|
||||
const scrollDown = 'scroll-down';
|
||||
let lastScroll = 0;
|
||||
const body = document.body;
|
||||
const scrollUp = 'scroll-up';
|
||||
const scrollDown = 'scroll-down';
|
||||
let lastScroll = 0;
|
||||
|
||||
window.addEventListener('scroll', () => {
|
||||
const currentScroll = window.pageYOffset;
|
||||
window.addEventListener('scroll', () => {
|
||||
const currentScroll = window.pageYOffset;
|
||||
|
||||
if (currentScroll <= 0) {
|
||||
body.classList.remove(scrollUp);
|
||||
return;
|
||||
}
|
||||
if (currentScroll <= 0) {
|
||||
body.classList.remove(scrollUp);
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentScroll > lastScroll && !body.classList.contains(scrollDown)) {
|
||||
body.classList.remove(scrollUp);
|
||||
body.classList.add(scrollDown);
|
||||
} else if (
|
||||
currentScroll < lastScroll &&
|
||||
body.classList.contains(scrollDown)
|
||||
) {
|
||||
body.classList.remove(scrollDown);
|
||||
body.classList.add(scrollUp);
|
||||
}
|
||||
lastScroll = currentScroll;
|
||||
});
|
||||
if (currentScroll > lastScroll && !body.classList.contains(scrollDown)) {
|
||||
body.classList.remove(scrollUp);
|
||||
body.classList.add(scrollDown);
|
||||
} else if (currentScroll < lastScroll && body.classList.contains(scrollDown)) {
|
||||
body.classList.remove(scrollDown);
|
||||
body.classList.add(scrollUp);
|
||||
}
|
||||
lastScroll = currentScroll;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user