-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
75 lines (66 loc) · 2.43 KB
/
script.js
File metadata and controls
75 lines (66 loc) · 2.43 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
document.addEventListener('DOMContentLoaded', () => {
const scrollToTopButton = document.getElementById('scroll-to-top');
const featureCards = document.querySelectorAll('.feature-card');
const navLinks = document.querySelectorAll('.nav-links');
const ctaButton = document.getElementById('cta-button');
const modal = document.getElementById('modal');
const closeButton = document.querySelector('.close-button');
const menuIcon = document.querySelector('.menu-icon');
const navMenu = document.querySelector('.nav-menu');
// Mobile menu toggle
menuIcon.addEventListener('click', () => {
navMenu.classList.toggle('active');
});
// Modal functionality
ctaButton.addEventListener('click', (e) => {
e.preventDefault();
modal.style.display = 'block';
});
closeButton.addEventListener('click', () => {
modal.style.display = 'none';
});
window.addEventListener('click', (event) => {
if (event.target == modal) {
modal.style.display = 'none';
}
});
// Smooth scroll for navigation links
navLinks.forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href');
const targetElement = document.querySelector(targetId);
if(targetElement) {
targetElement.scrollIntoView({ behavior: 'smooth' });
}
if (navMenu.classList.contains('active')) {
navMenu.classList.remove('active');
}
});
});
// Scroll-to-top button functionality
window.addEventListener('scroll', () => {
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
scrollToTopButton.style.display = 'block';
} else {
scrollToTopButton.style.display = 'none';
}
});
scrollToTopButton.addEventListener('click', () => {
window.scrollTo({ top: 0, behavior: 'smooth' });
});
// Fade-in animation for feature cards
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
observer.unobserve(entry.target);
}
});
}, {
threshold: 0.1
});
featureCards.forEach(card => {
observer.observe(card);
});
});