Spaces:
Running
Running
File size: 1,629 Bytes
0e93776 4296ff2 e59f94b 4f0acd3 e59f94b 4f0acd3 e59f94b 4296ff2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
document.addEventListener('DOMContentLoaded', function() {
// Animate elements on scroll
const animateOnScroll = function() {
const elements = document.querySelectorAll('.animate-on-scroll');
elements.forEach(element => {
const elementPosition = element.getBoundingClientRect().top;
const screenPosition = window.innerHeight / 1.3;
if (elementPosition < screenPosition) {
element.classList.add('animate-fade-in');
}
});
};
// Run once on load
animateOnScroll();
// Run on scroll
window.addEventListener('scroll', animateOnScroll);
// Mobile menu toggle
document.addEventListener('click', function(e) {
const mobileMenuButton = e.target.closest('#mobile-menu-button');
const mobileMenu = document.getElementById('mobile-menu');
if (mobileMenuButton && mobileMenu) {
mobileMenu.classList.toggle('open');
const icon = mobileMenuButton.querySelector('i');
if (mobileMenu.classList.contains('open')) {
feather.replace({ name: 'x' });
} else {
feather.replace({ name: 'menu' });
}
}
});
// Form submission
const form = document.querySelector('form');
if (form) {
form.addEventListener('submit', function(e) {
e.preventDefault();
// Here you would typically send the form data to your server
alert('Спасибо! Мы свяжемся с вами в ближайшее время.');
form.reset();
});
}
}); |