I am trying to use window.getComputedStyle to get the elements the mouse hover info. More specifically the cursor type ( but not relevant)
The issue is that for some reason it returns an error when hovering the elements below the fold
Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
document.querySelector("body").addEventListener("mousemove", (e) => {
console.log(window.getComputedStyle(document.elementFromPoint(e.pageX, e.pageY)))
});
div{
padding: 100px 30px;
}
<div>
Item here
</div>
<div>
Item here
</div>
<div>
Item here
</div>
<div>
Item here
</div>
<div>
Item here
</div>
<div>
Item here
</div>
<div>
Item here
</div>
<div>
Item here
</div>