/
maaxutka
/
computer_wizard
Обзор
Документация
Войти
/
maaxutka
/
computer_wizard
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
js.js
63 строки
3 KB
maaxutka
create: js.js, style.css, index.html
12 май 2026, 20:49
Верифицирован
12 май 2026, 20:49
739a629
Код
Авторство
О чём код?
// Mobile menu toggle document.querySelector('.mobile-menu-btn').addEventListener('click', function() { document.querySelector('nav').classList.toggle('active'); this.querySelector('i').classList.toggle('fa-bars'); this.querySelector('i').classList.toggle('fa-times'); }); // Close mobile menu when clicking on a link document.querySelectorAll('nav a').forEach(link => { link.addEventListener('click', () => { document.querySelector('nav').classList.remove('active'); document.querySelector('.mobile-menu-btn i').classList.remove('fa-times'); document.querySelector('.mobile-menu-btn i').classList.add('fa-bars'); }); }); // Scroll animations function checkVisibility() { const elements = document.querySelectorAll('.service-card, .about-text, .about-image, .step'); elements.forEach(element => { const rect = element.getBoundingClientRect(); const windowHeight = window.innerHeight || document.documentElement.clientHeight; if (rect.top <= windowHeight - 100) { element.classList.add('visible'); } }); } // Initial check window.addEventListener('load', checkVisibility); window.addEventListener('scroll', checkVisibility); // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function(e) { e.preventDefault(); const targetId = this.getAttribute('href'); if (targetId === '#') return; const targetElement = document.querySelector(targetId); if (targetElement) { window.scrollTo({ top: targetElement.offsetTop - 80, behavior: 'smooth' }); } }); }); // Header scroll effect window.addEventListener('scroll', function() { const header = document.querySelector('header'); if (window.scrollY > 100) { header.style.padding = '10px 0'; header.style.boxShadow = '0 5px 20px rgba(0, 0, 0, 0.1)'; } else { header.style.padding = '20px 0'; header.style.boxShadow = '0 5px 20px rgba(0, 0, 0, 0.1)'; } });