-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
101 lines (80 loc) · 3.11 KB
/
index.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// document.addEventListener("DOMContentLoaded", function () {
// const startTime = performance.now();
// window.addEventListener("load", function () {
// const endTime = performance.now();
// const loadingTime = endTime - startTime;
// const minimumDuration = 2000;
// const animationDuration = Math.max(minimumDuration, loadingTime);
// setTimeout(function () {
// document.getElementById("preloader-container").classList.add("hidden");
// document.getElementById("content").classList.remove("hidden");
// }, animationDuration);
// });
// });
// document.addEventListener("DOMContentLoaded", function () {
// const startTime = performance.now();
// window.addEventListener("load", function () {
// const animationDuration = 5000;
// setTimeout(function () {
// document.getElementById("preloader-container").classList.add("hidden");
// document.getElementById("content").classList.remove("hidden");
// }, animationDuration);
// });
// });
// document.addEventListener("DOMContentLoaded", function () {
// setTimeout(function () {
// document.getElementById("preloader-container").classList.add("hidden");
// document.getElementById("content").classList.remove("hidden");
// }, 5000);
// });
// setTimeout(function () {
// document.getElementById("preloader-container").classList.add("hidden");
// document.getElementById("content").classList.remove("hidden");
// }, 5000);
document.getElementById("preloader-container").classList.add("hidden");
document.getElementById("content").classList.remove("hidden");
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(".hiddenn");
hiddenElements.forEach((el) => observer.observe(el));
//gallery =>
const obs = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.classList.add("someshow");
} else {
entry.target.classList.remove("someshow");
}
});
});
const hiddenGalleryElements = document.querySelectorAll(".sometry");
hiddenGalleryElements.forEach((el) => obs.observe(el));
document.addEventListener("DOMContentLoaded", function () {
var header = document.getElementById("header");
window.onscroll = function () {
// Add or remove the "shrink" class based on scroll position
if (window.pageYOffset > 50) {
header.classList.add("shrink");
} else {
header.classList.remove("shrink");
}
};
});
distance.oninput = (e) => {
wrap.style.setProperty("--distance", e.target.value + "%");
};
thickness.oninput = (e) => {
wrap.style.setProperty("--border", e.target.value + "px");
};
function toggleNavItems() {
const navItems = document.getElementById("nav-items");
navItems.classList.toggle("nav-show");
}