-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
74 lines (65 loc) · 2.15 KB
/
Copy pathscript.js
File metadata and controls
74 lines (65 loc) · 2.15 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
// Smooth nav highlight on scroll
const sections = document.querySelectorAll('section[id]');
const navLinks = document.querySelectorAll('.nav-links a[href^="#"]');
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
navLinks.forEach(link => {
link.style.color = '';
if (link.getAttribute('href') === '#' + entry.target.id) {
link.style.color = '#F1F0F5';
}
});
}
});
}, { threshold: 0.4 });
sections.forEach(s => observer.observe(s));
// Register form submit
function handleSubmit(e) {
e.preventDefault();
const form = e.target;
form.innerHTML = `
<div class="success-msg">
<h3>You're in! 🎉</h3>
<p>Thanks for applying to ClaudeHacks. We'll be in touch within 5 business days.</p>
</div>
`;
}
// Animate stat numbers on scroll
const statNumbers = document.querySelectorAll('.stat-number');
const statObserver = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
statObserver.unobserve(entry.target);
}
});
}, { threshold: 0.5 });
statNumbers.forEach(el => {
el.style.opacity = '0';
el.style.transform = 'translateY(20px)';
el.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
statObserver.observe(el);
});
// Stagger track cards on scroll
const cards = document.querySelectorAll('.track-card, .faq-item, .prize-card');
const cardObserver = new IntersectionObserver((entries) => {
entries.forEach((entry, i) => {
if (entry.isIntersecting) {
setTimeout(() => {
entry.target.style.opacity = '1';
entry.target.style.transform = entry.target.classList.contains('prize-gold')
? 'scale(1.05) translateY(0)'
: 'translateY(0)';
}, 80 * i);
cardObserver.unobserve(entry.target);
}
});
}, { threshold: 0.15 });
cards.forEach(card => {
card.style.opacity = '0';
card.style.transform = 'translateY(24px)';
card.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
cardObserver.observe(card);
});