fix: 🐛 scroll
This commit is contained in:
parent
d173aea0e4
commit
6b7a18b967
|
@ -133,6 +133,22 @@ onMounted(() => {
|
||||||
if (!isDesktop.value) {
|
if (!isDesktop.value) {
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
if (window.innerWidth >= DESKTOP_THRESHOLD) isDesktop.value = true;
|
if (window.innerWidth >= DESKTOP_THRESHOLD) isDesktop.value = true;
|
||||||
|
let scrollPos = 0;
|
||||||
|
const postButton = document.getElementById('postButton');
|
||||||
|
|
||||||
|
function checkPosition() {
|
||||||
|
let windowY = window.scrollY;
|
||||||
|
if (postButton != null) {
|
||||||
|
if (windowY < scrollPos) {
|
||||||
|
postButton.style.transform = 'scale(1)';
|
||||||
|
} else {
|
||||||
|
postButton.style.transform = 'scale(0)';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scrollPos = windowY;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('scroll', checkPosition);
|
||||||
}, { passive: true });
|
}, { passive: true });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -171,23 +187,6 @@ function top() {
|
||||||
window.scroll({ top: 0, behavior: 'smooth' });
|
window.scroll({ top: 0, behavior: 'smooth' });
|
||||||
}
|
}
|
||||||
|
|
||||||
let scrollPos = 0;
|
|
||||||
const postButton = document.getElementById('postButton');
|
|
||||||
|
|
||||||
function checkPosition() {
|
|
||||||
let windowY = window.scrollY;
|
|
||||||
if (postButton != null) {
|
|
||||||
if (windowY < scrollPos) {
|
|
||||||
postButton.style.transform = 'scale(1)';
|
|
||||||
} else {
|
|
||||||
postButton.style.transform = 'scale(0)';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scrollPos = windowY;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('scroll', checkPosition);
|
|
||||||
|
|
||||||
const wallpaper = localStorage.getItem('wallpaper') != null;
|
const wallpaper = localStorage.getItem('wallpaper') != null;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue