-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
41 lines (36 loc) · 760 Bytes
/
script.js
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
const burger = document
.querySelector('.burger');
const navLinks = document
.querySelector('.nav-links');
burger.addEventListener('click',
() => {
navLinks.classList.toggle(
'active');
burger.classList.toggle(
'toggle');
});
const faders = document
.querySelectorAll('.fade-in');
const appearOptions = {
threshold: 0.2,
rootMargin: "0px 0px -50px 0px"
};
const appearOnScroll =
new IntersectionObserver(
function(entries,
appearOnScroll) {
entries.forEach(entry => {
if (!entry.isIntersecting) {
return;
} else {
entry.target.classList.add(
'show');
appearOnScroll.unobserve(
entry.target
);
}
});
}, appearOptions);
faders.forEach(fader => {
appearOnScroll.observe(fader);
});