CoolFace
Apppublic

AOTCS/aotcs-ru-digital-command-center

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
script.js31 linesDownload Raw Back to root
1// Инициализация Feather Icons2document.addEventListener('DOMContentLoaded', function() {3    feather.replace();4    5    // Плавная прокрутка для якорных ссылок6    document.querySelectorAll('a[href^="#"]').forEach(anchor => {7        anchor.addEventListener('click', function (e) {8            e.preventDefault();9            document.querySelector(this.getAttribute('href')).scrollIntoView({10                behavior: 'smooth'11            });12        });13    });14    15    // Анимация элементов при скролле16    const animateOnScroll = function() {17        const elements = document.querySelectorAll('.animate-fade-in');18        elements.forEach(element => {19            const elementPosition = element.getBoundingClientRect().top;20            const screenPosition = window.innerHeight / 1.3;21            22            if (elementPosition < screenPosition) {23                element.style.opacity = '1';24                element.style.transform = 'translateY(0)';25            }26        });27    };28    29    window.addEventListener('scroll', animateOnScroll);30    animateOnScroll(); // Инициализация при загрузке31});