-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
37 lines (30 loc) · 1006 Bytes
/
script.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
// //menu
// const checkbox = document.getElementById('op');
// const mainContent = document.getElementById('content');
// checkbox.addEventListener('change', function () {
// if (checkbox.checked) {
// // Checkbox is checked, apply z-index: -1000
// mainContent.style.zIndex = '-1000';
// } else {
// // Checkbox is unchecked, remove the z-index property
// mainContent.style.removeProperty('z-index');
// }
// });
// //gif
const gif = document.getElementById('autoplayGif');
const options = {
root: null,
rootMargin: '0px',
threshold: 0.5,
};
const handleIntersection = (entries, observer) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
gif.src = gif.src;
} else {
gif.src = gif.src;
}
});
};
const observer = new IntersectionObserver(handleIntersection, options);
observer.observe(gif);