JSFiddle - React, Tailwind, and code Playground

by kougiland

HTML

<div id="mydiv" style="width: 300px; height: 300px;"></div>
<img id="myimg" style="position: absolute; width: 30px; height: 30px;" alt="" src="http://x00.xanga.com/f12f400615d32251789011/b199947933.jpg"/>

JavaScript

document.getElementById("mydiv").onmousemove = function(e) {
    document.getElementById("myimg").style.top = e.pageY + "px";
}