-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
51 lines (42 loc) · 1.65 KB
/
Copy pathscript.js
File metadata and controls
51 lines (42 loc) · 1.65 KB
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
47
48
49
50
51
// Плавная прокрутка для навигации
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const targetId = this.getAttribute('href');
const targetElement = document.querySelector(targetId);
window.scrollTo({
top: targetElement.offsetTop - 100,
behavior: 'smooth'
});
});
});
// Анимация появления элементов при прокрутке
const animateOnScroll = () => {
const elements = document.querySelectorAll('.feature-card, .step, .about-content');
elements.forEach(element => {
const elementPosition = element.getBoundingClientRect().top;
const screenPosition = window.innerHeight / 1.3;
if (elementPosition < screenPosition) {
element.classList.add('animate');
}
});
};
window.addEventListener('scroll', animateOnScroll);
// Обработка формы контактов (заглушка)
const contactForm = document.querySelector('.contact-form');
if (contactForm) {
contactForm.addEventListener('submit', function(e) {
e.preventDefault();
alert('Спасибо за ваше сообщение! Мы свяжемся с вами в ближайшее время.');
this.reset();
});
}
// Анимация фиксированного меню
window.addEventListener('scroll', function() {
const header = document.querySelector('header');
if (window.scrollY > 50) {
header.classList.add('scrolled');
} else {
header.classList.remove('scrolled');
}
});