How to display an image that follows the cursor when hovering over text

I 've find this code but I can’t manage to use it with readymag id
`

<a href="#" onmouseover="interval()">Link</a>

function interval() {
    while (true) {
        setInterval(showImage, 1);
    }
}

function showImage() {

    var x = clientX;
    var y = clientY;
    var image = document.getElementById("hoverimage");
    image.style.left = x;
    image.style.top = y;
 }

Hi @Bonji I imagine this code was found on another website? Would you mind sharing the link as it’s missing a few bits to allow us to make it work for Readymag.

Hi @HEADLESS.HORSE , yes I found it here: javascript - Make image follow cursor when hovering over an element - Stack Overflow

What parts are being used to make a code like this work in Readymag? What is required?