ript.js:8 Uncaught TypeError: Cannot read properties of null (reading 'style')

32 Views Asked by At

I want to movie circle with cursor I wrote this js code but it is showing some error can someone please help me out of this why it is through this error:

script.js:8 Uncaught TypeError: Cannot read properties of null (reading 'style')


// mouse circle


const mouseCircle =  document.querySelector('.ouse-circle')
const mouseDot = document.querySelector('.mouse-dot')

const mouseCircleFn = (x,y)=>{
    mouseCircle.style.cssText = `top:${y}px;left:${x}px`;
    mouseDot.style.cssText = `top:${y}px;left:${x}px`;
};

document.body.addEventListener("mousemove", (e) =>{
    let x = e.clientX;
    let y = e.clientY;

    mouseCircleFn(x,y)
});


// end of mouse circle
0

There are 0 best solutions below