-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
27 lines (24 loc) · 1018 Bytes
/
Copy pathscript.js
File metadata and controls
27 lines (24 loc) · 1018 Bytes
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
document.addEventListener('DOMContentLoaded', () => {
// Setup generic section observer for Fade In effect
const observerOptions = {
root: null,
rootMargin: '0px',
threshold: 0.05 // Trigger slightly earlier
};
const observer = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
observer.unobserve(entry.target); // Run once
}
});
}, observerOptions);
// Observe Sections and List Items for a granular flow
const animatedElements = document.querySelectorAll('.content-section, .timeline-item, .paper-list li, .award-item, .exp-item');
animatedElements.forEach((el, index) => {
el.classList.add('fade-in');
// Optional: slight delay based on index within section could be complex,
// but let's keep it simple: just observe them.
observer.observe(el);
});
});