We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ed18b9d commit fa32a0cCopy full SHA for fa32a0c
1 file changed
src/layouts/Layout.astro
@@ -64,7 +64,7 @@ const { title } = Astro.props;
64
65
const cards = document.querySelectorAll("[data-spotlight]");
66
67
- document.addEventListener("mousemove", (e) => {
+ function handleCardsSpotlightPosition(e) {
68
cards.forEach((card) => {
69
const rect = card.getBoundingClientRect();
70
const x = e.clientX - rect.left;
@@ -73,7 +73,10 @@ const { title } = Astro.props;
73
card.style.setProperty("--x", `${x}px`);
74
card.style.setProperty("--y", `${y}px`);
75
});
76
- });
+ }
77
+
78
+ document.addEventListener("mousemove", handleCardsSpotlightPosition);
79
+ document.addEventListener("wheel", handleCardsSpotlightPosition);
80
81
</script>
82
</body>
0 commit comments