-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
32 lines (25 loc) · 961 Bytes
/
app.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
document.addEventListener('DOMContentLoaded', () => {
const sections = document.querySelectorAll('section');
sections.forEach(section => {
const button = section.querySelector('button');
const close = section.querySelector('.close');
button.addEventListener('click', () => {
document.body.style.overflow = 'hidden';
window.scrollTo({
top: section.offsetTop,
behavior: 'smooth',
})
section.classList.add('transition', 'animate');
setTimeout(() => {
section.classList.add('animate-completed');
}, 1000)
});
close.addEventListener('click', () => {
document.body.style.overflow = 'auto';
section.classList.remove('animate-completed');
setTimeout(() => {
section.classList.remove('animate');
}, 100);
});
})
});