This commit is contained in:
@@ -55,6 +55,21 @@
|
||||
});
|
||||
});
|
||||
|
||||
const motionAllowed = !window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
||||
if (motionAllowed) {
|
||||
document.querySelectorAll("[data-radar-illustration]").forEach((illustration) => {
|
||||
illustration.addEventListener("pointermove", (event) => {
|
||||
const bounds = illustration.getBoundingClientRect();
|
||||
illustration.style.setProperty("--radar-x", `${((event.clientX - bounds.left) / bounds.width - .5) * 10}px`);
|
||||
illustration.style.setProperty("--radar-y", `${((event.clientY - bounds.top) / bounds.height - .5) * 10}px`);
|
||||
});
|
||||
illustration.addEventListener("pointerleave", () => {
|
||||
illustration.style.removeProperty("--radar-x");
|
||||
illustration.style.removeProperty("--radar-y");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if (event.key === "Escape") closeNavigation();
|
||||
if (event.key === "/" && !/INPUT|TEXTAREA|SELECT/.test(document.activeElement?.tagName || "")) {
|
||||
|
||||
Reference in New Issue
Block a user