animations

This commit is contained in:
N0\A
2025-10-30 08:41:03 +01:00
parent a3d382b1b7
commit eadbf18661
5 changed files with 385 additions and 142 deletions

31
animations.js Normal file
View File

@@ -0,0 +1,31 @@
(function () {
const backToTopButton = document.getElementById("back-to-top");
if (backToTopButton) {
function toggleBackToTop() {
if (window.pageYOffset > 300) {
backToTopButton.classList.add("visible");
} else {
backToTopButton.classList.remove("visible");
}
}
backToTopButton.addEventListener("click", function () {
window.scrollTo({
top: 0,
behavior: "smooth",
});
});
window.addEventListener("scroll", toggleBackToTop);
toggleBackToTop();
}
const listItems = document.querySelectorAll("li");
listItems.forEach((item, index) => {
if (!item.style.animationDelay) {
item.style.animationDelay = `${0.1 + index * 0.05}s`;
}
});
})();