-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
60 lines (53 loc) · 1.97 KB
/
Copy pathscript.js
File metadata and controls
60 lines (53 loc) · 1.97 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
52
53
54
55
56
57
58
59
60
// Mobile menu toggle
document.addEventListener('DOMContentLoaded', () => {
const toggle = document.querySelector('.mobile-toggle');
const navLinks = document.querySelector('.nav-links');
toggle.addEventListener('click', () => {
navLinks.classList.toggle('active');
const icon = toggle.querySelector('i');
if (navLinks.classList.contains('active')) {
icon.className = 'fas fa-times';
} else {
icon.className = 'fas fa-bars';
}
});
// Close menu on link click
navLinks.querySelectorAll('a').forEach(link => {
link.addEventListener('click', () => {
navLinks.classList.remove('active');
toggle.querySelector('i').className = 'fas fa-bars';
});
});
// Navbar background on scroll
const navbar = document.querySelector('.navbar');
window.addEventListener('scroll', () => {
if (window.scrollY > 50) {
navbar.style.boxShadow = '0 2px 20px rgba(0,0,0,0.1)';
} else {
navbar.style.boxShadow = 'none';
}
});
// Scroll animations
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
observer.unobserve(entry.target);
}
});
}, observerOptions);
const animatedElements = document.querySelectorAll(
'.product-card, .help-card, .stat-card, .team-member, .history-content, .history-image-wrapper, .testimonial-dark, .testimonial-right'
);
animatedElements.forEach(el => {
el.style.opacity = '0';
el.style.transform = 'translateY(30px)';
el.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
observer.observe(el);
});
});