Uncaught TypeError: Cannot read properties of null (reading 'style') at HTMLAnchorElement.animateit animateit @
This is my code:
`(function () {
const aLink = document.querySelectorAll('a');
const cursor = document.querySelector('.cursor');
const animateit = function (e) {
const span = this.querySelector('span');
const { offsetX: x, offsetY: y } = e,
{ offsetWidth: width, offsetHeight: height } = this,
move = 35,
xMove = x / width * (move * 2) - move,
yMove = y / height * (move * 2) - move;
span.style.transform = `translate(${xMove}px, ${yMove}px)`;
if (e.type === 'mouseleave') span.style.transform = '';
};
aLink.forEach(b => b.addEventListener('mousemove', animateit));
aLink.forEach(b => b.addEventListener('mouseleave', animateit));
})();`
I was expectiong to just work normally… But it work sbut I dont now what has happened but it shows that style is null.