-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
49 lines (44 loc) · 1.67 KB
/
Copy pathscript.js
File metadata and controls
49 lines (44 loc) · 1.67 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
// script.js
document.addEventListener('DOMContentLoaded', () => {
// Add smooth reveal animations to sections when scrolling
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 sections = document.querySelectorAll('.section');
sections.forEach(section => {
section.style.opacity = '0';
section.style.transform = 'translateY(30px)';
section.style.transition = 'all 0.8s ease-out';
observer.observe(section);
});
const cards = document.querySelectorAll('.glass-card');
cards.forEach((card, index) => {
card.style.opacity = '0';
card.style.transform = 'translateY(30px)';
card.style.transition = `all 0.6s ease-out ${index % 3 * 0.1}s`;
observer.observe(card);
});
// Make navbar transparent at top, solid on scroll
const navbar = document.querySelector('.navbar');
window.addEventListener('scroll', () => {
if (window.scrollY > 50) {
navbar.style.background = 'rgba(11, 15, 25, 0.9)';
navbar.style.boxShadow = '0 4px 30px rgba(0, 0, 0, 0.5)';
} else {
navbar.style.background = 'rgba(11, 15, 25, 0.5)';
navbar.style.boxShadow = 'none';
}
});
// Trigger initial state
window.dispatchEvent(new Event('scroll'));
});