fix scroll anim bug?

This commit is contained in:
ThatOneCalculator 2022-11-07 13:52:51 -08:00
parent def4c95090
commit c96c89f213
2 changed files with 1 additions and 20 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "calckey", "name": "calckey",
"version": "12.119.0-calc.9.21", "version": "12.119.0-calc.9.22",
"codename": "aqua", "codename": "aqua",
"repository": { "repository": {
"type": "git", "type": "git",

View file

@ -178,25 +178,6 @@ onMounted(() => {
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
if (window.innerWidth >= DESKTOP_THRESHOLD) isDesktop.value = true; if (window.innerWidth >= DESKTOP_THRESHOLD) isDesktop.value = true;
}, { passive: true }); }, { passive: true });
function createScrollStopListener(element: Window, callback: TimerHandler, timeout: number): () => void {
let handle = 0;
const onScroll = () => {
if (handle) {
clearTimeout(handle);
}
postButton.style.transform = 'scale(0)';
handle = setTimeout(callback, timeout || 200);
};
element.addEventListener('scroll', onScroll, { passive: true });
return () => {
element.removeEventListener('scroll', onScroll);
};
}
createScrollStopListener(window, () => {
postButton.style.transform = 'scale(1)';
} , 200);
} }
}); });