document.addEventListener("DOMContentLoaded", function () { function triggerAnimations() { var animatedBlocks = document.querySelectorAll("[data-animate]"); animatedBlocks.forEach(function (block) { var rect = block.getBoundingClientRect(); var windowHeight = window.innerHeight; if (rect.top <= windowHeight * 0.9 && !block.classList.contains("t-animate_started")) { block.classList.add("t-animate_started"); block.style.opacity = 1; block.style.transform = "translateY(0px)"; block.style.transition = "opacity 0.8s ease-out, transform 0.8s ease-out"; } }); } triggerAnimations(); // Запуск при загрузке window.addEventListener("scroll", triggerAnimations); window.addEventListener("resize", triggerAnimations); });