I figured out how to do it: https://benoitlefeuvre.com/
<script>
let cursorX = 0;
let cursorY = 0;
let cursorMoved = false;
document.addEventListener("mousemove", (e) => {
if (!cursorMoved) {
showCursor();
cursorMoved = true;
}
cursorX = e.clientX;
cursorY = e.clientY;
updateCursorPosition();
});
function updateCursorPosition() {
const followTexts = document.querySelectorAll(".numbers");
followTexts.forEach((followText) => {
followText.style.left = cursorX + "px";
followText.style.top = cursorY + "px";
});
}
function showCursor() {
const followTexts = document.querySelectorAll(".numbers");
followTexts.forEach((followText) => {
followText.style.display = "block";
});
}
function hideCursor() {
const followTexts = document.querySelectorAll(".numbers");
followTexts.forEach((followText) => {
followText.style.display = "none";
});
}
window.laytheme.on("newpageshown", function() {
cursorMoved = false;
hideCursor();
});
</script>