-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
34 lines (28 loc) · 964 Bytes
/
main.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
// Album picture fly-in
const firstAboutPic = document.querySelector('.about__pic--1');
const middleAboutPic = document.querySelector('.about__pic--2');
const lastAboutPic = document.querySelector('.about__pic--3');
const albumShow = (entries, observer) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
if (window.innerWidth <= 1100) {
} else {
lastAboutPic.classList.add('about__pic--appear3');
middleAboutPic.classList.add('about__pic--appear2');
firstAboutPic.classList.add('about__pic--appear1');
}
}
});
};
const options = {
rootMargin: '0px 0px 10% 0px',
};
const observer = new IntersectionObserver(albumShow, options);
observer.observe(lastAboutPic);
// Disabling arrow glow on scroll
const scrollArrow = document.querySelector('.scroll');
window.addEventListener('scroll', (e) => {
if (window.scrollY > 10) {
scrollArrow.classList.replace('scroll', 'scroll--done');
}
});