<div class="cursor"></div>
body {
background-color: white;
cursor: none;
height: 120vh;
}
.cursor {
position: fixed;
width: 10px;
height: 10px;
background-color: pink;
border: 1px solid black;
border-radius: 50%;
pointer-events: none;
z-index: 9999;
}
xxxxxxxxxx
const cursor = document.querySelector('.cursor');
const positionCursor = (e) => {
const mouseY = e.clientY;
const mouseX = e.clientX;
cursor.style.top = `${mouseY}px`;
cursor.style.left = `${mouseX}px`;
}
window.addEventListener('mousemove', positionCursor);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.