-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
55 lines (41 loc) · 1.82 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
function isMobileDevice() {
var screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var screenHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
return screenWidth < 768 || screenHeight < 768; // Adjust the threshold as per your requirements
}
const opacityObserver = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
// console.log(entry)
if (entry.isIntersecting) {
entry.target.classList.add('showo')
} else {
entry.target.classList.remove('showo')
}
})
})
const hiddenOpacityElements = document.querySelectorAll(".hiddeno")
hiddenOpacityElements.forEach((el) => opacityObserver.observe(el))
const slideObserver = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
// console.log(entry)
if (entry.isIntersecting) {
entry.target.classList.add('shows')
} else {
entry.target.classList.remove('shows')
}
})
})
const hiddenSlideElements = document.querySelectorAll(".hiddens")
hiddenSlideElements.forEach((el) => slideObserver.observe(el))
const slideListObserver = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
// console.log(entry)
if (entry.isIntersecting) {
entry.target.classList.add('showlist')
} else {
entry.target.classList.remove('showlist')
}
})
})
const hiddenSlideListElements = document.querySelectorAll(".hiddenlist")
hiddenSlideListElements.forEach((el) => slideListObserver.observe(el))