-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
50 lines (42 loc) · 1.32 KB
/
scripts.js
File metadata and controls
50 lines (42 loc) · 1.32 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
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Section observer for fade-in animations
const sections = document.querySelectorAll('section');
const options = {
threshold: 0.1
};
const observer = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('fade-in');
observer.unobserve(entry.target);
}
});
}, options);
sections.forEach(section => {
observer.observe(section);
});
// Testimonial carousel functionality
const testimonials = document.querySelectorAll('.testimonial');
let currentTestimonial = 0;
function showTestimonial(index) {
testimonials.forEach((testimonial, i) => {
testimonial.style.display = i === index ? 'block' : 'none';
});
}
function nextTestimonial() {
currentTestimonial = (currentTestimonial + 1) % testimonials.length;
showTestimonial(currentTestimonial);
}
// Initialize testimonial carousel
if (testimonials.length > 0) {
showTestimonial(0);
setInterval(nextTestimonial, 5000);
}