1译荞、html修改元素隨機坐標
function randomCoordinate(e) {
var d = {
w:Math.floor(Math.random() * window.innerWidth),
h:Math.floor(Math.random() * window.innerHeight)
}
e.style.zIndex = '999';
e.style.position = 'fixed';
e.style.top = d.h + 'px';
e.style.left = d.w + 'px';
return d;
}
randomCoordinate($("#QUERY")[0]);
2、html隨機對指定標簽修改坐標
for (let i = 0; i < $("button").length; i++) {
randomCoordinate($("button")[i])
}