It is necessary to make the drawing that I drew (the usual square) moved behind the cursor. Tell me how to implement?

    1 answer 1

    window.addEventListener('mousemove',function(ev){(function(e){ e.style.left = ev.clientX+"px"; e.style.top = ev.clientY+"px"; })(document.getElementById('box'))},false); 
     <img id="box" style="position:fixed;" src="http://old.rk.karelia.ru/wp-content/uploads/2011/10/chernyiy-kvadrat.jpg" width="50" height="50">