-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
76 lines (68 loc) · 2.44 KB
/
script.js
File metadata and controls
76 lines (68 loc) · 2.44 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
76
// Mobile menu toggle
const menuBtn = document.querySelector('.mobile-menu-btn');
const mobileMenu = document.querySelector('.mobile-menu');
if (menuBtn) {
menuBtn.addEventListener('click', () => {
mobileMenu.classList.toggle('active');
menuBtn.classList.toggle('active');
});
// Close menu when a link is clicked
mobileMenu.querySelectorAll('a').forEach(link => {
link.addEventListener('click', () => {
mobileMenu.classList.remove('active');
menuBtn.classList.remove('active');
});
});
}
// Scroll-based animations with IntersectionObserver
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
observer.unobserve(entry.target);
}
});
}, observerOptions);
// Observe feature cards, steps, and SDK cards
document.querySelectorAll('.deploy-methods, .secrets-terminal, .tools-panel, .feature-card, .step, .sdk-card, .cta-inner').forEach(el => {
el.classList.add('animate-on-scroll');
observer.observe(el);
});
// Add CSS for scroll animations
const style = document.createElement('style');
style.textContent = `
.animate-on-scroll {
opacity: 0;
transform: translateY(24px);
transition: opacity 0.5s ease, transform 0.5s ease;
}
.animate-on-scroll.visible {
opacity: 1;
transform: translateY(0);
}
.feature-card.animate-on-scroll:nth-child(2) { transition-delay: 0.1s; }
.feature-card.animate-on-scroll:nth-child(3) { transition-delay: 0.2s; }
.feature-card.animate-on-scroll:nth-child(4) { transition-delay: 0.1s; }
.feature-card.animate-on-scroll:nth-child(5) { transition-delay: 0.2s; }
.feature-card.animate-on-scroll:nth-child(6) { transition-delay: 0.3s; }
.sdk-card.animate-on-scroll:nth-child(2) { transition-delay: 0.1s; }
.sdk-card.animate-on-scroll:nth-child(3) { transition-delay: 0.2s; }
.sdk-card.animate-on-scroll:nth-child(4) { transition-delay: 0.3s; }
`;
document.head.appendChild(style);
// Smooth nav background on scroll
const nav = document.querySelector('.nav');
let lastScroll = 0;
window.addEventListener('scroll', () => {
const currentScroll = window.scrollY;
if (currentScroll > 50) {
nav.style.borderBottomColor = 'rgba(39, 39, 42, 0.8)';
} else {
nav.style.borderBottomColor = 'rgba(39, 39, 42, 0.3)';
}
lastScroll = currentScroll;
}, { passive: true });