I want my cursor to be followed by a circle with a short delay. The problem is that it works really smoothly on Firefox while being very laggy on Chrome.
JS:
const cursor = document.querySelector('.cursor');
window.addEventListener('mousemove', moveCursor);
function moveCursor(e) {
cursor.style.top = e.clientY + "px";
cursor.style.left = e.clientX + "px";
}
CSS:
.cursor {
width: 30px;
height: 30px;
position: absolute;
transition-duration: 200ms;
transition-timing-function: ease-out;
}
I'm having a hard time cracking the code here and would appreciate some help on this matter. Also, I'm using Locomotive scroll but it shouldn't be a problem seeing that Firefox works as intended with the same code.