For example, I have a script that takes the mouse coordinates:
function posicaoMouse(ev){
ev.preventDefault();
var x = ev.clientX;
var y = ev.clientY;
console.log(x);
console.log(y);
}
And I would like the top and left to be defined by the x
and y
variables of the function posicaoMouse
, is it possible? <span class="duvida" id="duvida2" style="position: absolute; top:'$x' left:'$y'"> teste </span>