fix: 🐛 scroll

This commit is contained in:
ThatOneCalculator 2022-08-19 14:25:08 -07:00
parent d173aea0e4
commit 6b7a18b967
1 changed files with 16 additions and 17 deletions

View File

@ -133,6 +133,22 @@ onMounted(() => {
if (!isDesktop.value) {
window.addEventListener('resize', () => {
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 });
}
});
@ -171,23 +187,6 @@ function top() {
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;