-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
27 lines (24 loc) · 825 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
/*const observer = new IntersectionObserver((entries) =>{
entries.forEach((entry) => {
console.Log(entry)
if(entry.isIntersecting) {
entry.target.classList.add('show');
} else {
entry.target.classList.remove('show')
}
});
});
const hiddenElements = document.querySelectorAll('.hidden');
hiddenElements.forEach((el) => observer.observe(el));*/
const observer = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
console.log(entry)
if(entry.isIntersecting){
entry.target.classList.add("show")
} else{
entry.target.classList.remove("show")
}
});
});
const hiddenElements = document.querySelectorAll('.hidden-side, .hidden');
hiddenElements.forEach((el) => observer.observe(el));