-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
44 lines (37 loc) · 1.07 KB
/
Copy pathscript.js
File metadata and controls
44 lines (37 loc) · 1.07 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
const year = document.getElementById("year");
if (year) {
year.textContent = new Date().getFullYear();
}
const timelineItems = document.querySelectorAll(".timeline-item");
if (timelineItems.length > 0) {
const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.classList.add("is-visible");
observer.unobserve(entry.target);
}
});
},
{ threshold: 0.2 }
);
timelineItems.forEach((item) => observer.observe(item));
}
const projectCards = document.querySelectorAll(".project-card");
if (projectCards.length > 0) {
const projectObserver = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.classList.add("is-visible");
projectObserver.unobserve(entry.target);
}
});
},
{ threshold: 0.2 }
);
projectCards.forEach((card, index) => {
card.style.transitionDelay = `${index * 220}ms`;
projectObserver.observe(card);
});
}