// Анимация для игрового сайта document.addEventListener('DOMContentLoaded', function() { // Добавляем плавающую кнопку const floatingButton = document.createElement('div'); floatingButton.className = 'floating-icon'; floatingButton.innerHTML = ''; floatingButton.onclick = function() { const formElement = document.querySelector('.t-form__inputs'); if (formElement) { formElement.scrollIntoView({behavior: 'smooth'}); } }; document.body.appendChild(floatingButton); // Анимация статистики const animateStats = function() { const stats = document.querySelectorAll('.stat-number'); stats.forEach(stat => { const finalValue = stat.getAttribute('data-value'); if (!finalValue) return; let currentValue = 0; const duration = 2000; const increment = finalValue / (duration / 16); const timer = setInterval(() => { currentValue += increment; if (currentValue >= finalValue) { clearInterval(timer); currentValue = finalValue; } stat.textContent = Math.round(currentValue); }, 16); }); }; // Запускаем анимацию статистики когда она видна const statsSection = document.querySelector('.game-stats'); if (statsSection) { const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting && !statsSection.classList.contains('animated')) { statsSection.classList.add('animated'); animateStats(); } }); }, { threshold: 0.5 }); observer.observe(statsSection); } // Подключаем Font Awesome if (!document.querySelector('link[href*="font-awesome"]')) { const faLink = document.createElement('link'); faLink.rel = 'stylesheet'; faLink.href = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css'; document.head.appendChild(faLink); } // Подключаем шрифт Nunito if (!document.querySelector('link[href*="nunito"]')) { const fontLink = document.createElement('link'); fontLink.href = 'https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap'; fontLink.rel = 'stylesheet'; document.head.appendChild(fontLink); } });
Made on
Tilda