-
Notifications
You must be signed in to change notification settings - Fork 0
/
javascript.js
30 lines (26 loc) · 918 Bytes
/
javascript.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
window.onload = () => {
const faders = document.querySelectorAll('.fade-in');
const appearOptions = {
threshold: 0.1,
rootMargin: "0px 0px -10% 0px"
};
const appearOnScroll = new IntersectionObserver(function(entries, appearOnScroll) {
entries.forEach(entry => {
if (!entry.isIntersecting) {
return;
} else {
entry.target.classList.add('appear');
appearOnScroll.unobserve(entry.target);
}
})
}, appearOptions);
faders.forEach(fader => {
appearOnScroll.observe(fader);
});
}
const navLinks = document.querySelectorAll('.nav-item')
const menuToggle = document.getElementById('navbar-list')
const bsCollapse = new bootstrap.Collapse(menuToggle)
navLinks.forEach((l) => {
l.addEventListener('click', () => { bsCollapse.toggle() })
})