-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
38 lines (31 loc) · 877 Bytes
/
scripts.js
File metadata and controls
38 lines (31 loc) · 877 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
28
29
30
31
32
33
34
35
36
37
38
let docTitle = document.title;
window.addEventListener("blur", () =>{
document.title = "Where do you think you're going?";
})
windows.addEventListener("focus", () =>{
document.title = docTitle;
})
// scripts.js
document.addEventListener("DOMContentLoaded", function() {
const cards = document.querySelectorAll('.card');
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('in-view');
}
});
}, { threshold: 0.5 });
cards.forEach(card => {
observer.observe(card);
});
});
/* Add this CSS for the scroll animation */
.card {
opacity: 0;
transform: translateY(20px);
transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.card.in-view {
opacity: 1;
transform: translateY(0);
}