-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
68 lines (56 loc) · 1.84 KB
/
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
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
let light = "rgb(213, 213, 213)";
let dark = "rgb(30, 30, 30)";
if (
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches
) {
document
.querySelector('meta[name="theme-color"]')
.setAttribute("content", dark);
}
window
.matchMedia("(prefers-color-scheme: dark)")
.addEventListener("change", (event) => {
document
.querySelector('meta[name="theme-color"]')
.setAttribute("content", event.matches ? dark : light);
});
document.addEventListener("mousemove", function (event) {
// If a touch event is detected, return immediately
if (
"ontouchstart" in window ||
navigator.maxTouchPoints ||
window.innerWidth < 900
) {
return;
}
const follower = document.getElementById("follower");
// Function to update follower content and visibility
function updateFollowerContentAndVisibility(target, event) {
while (target) {
if (target.hasAttribute("data-tooltip")) {
// Set the inner HTML of the follower to the tooltip content
follower.innerHTML = target.getAttribute("data-tooltip");
// Update follower's position and make it visible
follower.style.left = event.pageX + "px";
follower.style.top = event.pageY + "px";
follower.style.display = "block"; // Make follower visible
return; // Exit the function once the tooltip is found and set
}
target = target.parentElement;
}
// If no tooltip element, make the follower invisible
follower.style.display = "none";
}
// Call the function with the current event target
updateFollowerContentAndVisibility(event.target, event);
});
const cards = document.querySelectorAll(".delay-show");
function easeInCards() {
cards.forEach((card, index) => {
setTimeout(() => {
card.classList.add("show");
}, index * 100);
});
}
easeInCards();