fixed scroll to tup button

This commit is contained in:
2025-08-18 10:24:08 +00:00
parent f7f2356510
commit a02da47e73
3 changed files with 8 additions and 6 deletions

View File

@ -143,10 +143,12 @@ const disableRightClickAndDrag = () => {
// Scroll to top button
const setupScrollToTopButton = () => {
const scrollToTopButton = document.querySelector('.scroll-to-top');
if (!scrollToTopButton) return;
scrollToTopButton.addEventListener('click', () => {
window.scrollTo({ top: 0, behavior: 'smooth' });
const scrollBtn = document.getElementById("scrollToTop");
window.addEventListener("scroll", () => {
scrollBtn.style.display = window.scrollY > 300 ? "block" : "none";
});
scrollBtn.addEventListener("click", () => {
window.scrollTo({ top: 0, behavior: "smooth" });
});
};