-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
39 lines (33 loc) · 898 Bytes
/
index.js
File metadata and controls
39 lines (33 loc) · 898 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
39
const faders = document.querySelectorAll(".fade-in");
const bottomSliders = document.querySelectorAll(".slide-in-bottom");
const leftSliders = document.querySelectorAll(".slide-in-left");
const rightSliders = document.querySelectorAll(".slide-in-right");
const options = {
threshold: 0,
rootMargin: "0px 0px -250px 0px",
};
const appearOnScroll = new IntersectionObserver(function (
entries,
appearOnScroll
) {
entries.forEach((entry) => {
if (!entry.isIntersecting) {
return;
}
entry.target.classList.add("appear");
appearOnScroll.unobserve(entry.target);
});
},
options);
faders.forEach((fader) => {
appearOnScroll.observe(fader);
});
bottomSliders.forEach((slider) => {
appearOnScroll.observe(slider);
});
leftSliders.forEach((slider) => {
appearOnScroll.observe(slider);
});
rightSliders.forEach((slider) => {
appearOnScroll.observe(slider);
});