JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test1" style="width:150px;height:150px;position:relative; padding:20px">
<iframe id="test2" src="http://www.w3schools.com" style=" position:absolute;"></iframe>
</div>
JavaScript
$("html").on('mousemove', function (e) {
var x = e.pageX - 12;
var y = e.pageY - 20;
$("#test1").css({
'top': y,
'left': x
});
});
$(function () {
$("#test1").click(function () {
$("#test2").hide();
});
});