mirror of
https://github.com/Dvorinka/Portfolio.git
synced 2026-10-28 07:41:22 +00:00
Add spotlight cards: glow border, image zoom, reveal stagger
Cards now carry a mouse-tracked radial border glow and inner spotlight, a blurred arrow badge over the image, saturate/zoom on hover, deeper shadow, and IntersectionObserver-driven staggered reveal. Hidden state gated behind .js so no-JS still renders. Authored By: TDvorak <[email protected]> Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
b672dc1a5b
commit
a73979f0d1
2 files changed
+68
-4
No files matched your search
@@ -1,5 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
document.documentElement.classList.add("js");
|
||||
|
||||
// Theme: persisted in sessionStorage, dark default.
|
||||
const root = document.documentElement;
|
||||
root.dataset.theme = sessionStorage.getItem("theme") || "dark";
|
||||
@@ -12,6 +14,28 @@ document.querySelector("[data-theme-btn]")?.addEventListener("click", () => {
|
||||
// Footer year
|
||||
document.getElementById("year").textContent = new Date().getFullYear();
|
||||
|
||||
// Card spotlight: track cursor into --mx/--my
|
||||
for (const card of document.querySelectorAll(".card")) {
|
||||
card.addEventListener("mousemove", (e) => {
|
||||
const r = card.getBoundingClientRect();
|
||||
card.style.setProperty("--mx", `${e.clientX - r.left}px`);
|
||||
card.style.setProperty("--my", `${e.clientY - r.top}px`);
|
||||
});
|
||||
}
|
||||
|
||||
// Staggered reveal on scroll
|
||||
const reveal = new IntersectionObserver((entries) => {
|
||||
for (const en of entries) {
|
||||
if (en.isIntersecting) {
|
||||
const cards = [...en.target.parentElement.children];
|
||||
en.target.style.transitionDelay = `${cards.indexOf(en.target) * 60}ms`;
|
||||
en.target.classList.add("in");
|
||||
reveal.unobserve(en.target);
|
||||
}
|
||||
}
|
||||
}, { threshold: 0.15 });
|
||||
document.querySelectorAll(".card").forEach((c) => reveal.observe(c));
|
||||
|
||||
// Contact form -> sendmail.tdvorak.dev
|
||||
const form = document.getElementById("contact-form");
|
||||
const status = document.getElementById("form-status");
|
||||
|
||||
Reference in new issue
Block a user