仅写出我知道的两种方法
方法一:
$(document).mousemove(function(e){
$("span").text(e.clientX + ", " + e.clientY);
var x =e.clientX;
var y = e.clientY;
document.getElementById("img").style.left=x+"px";
document.getElementById("img").style.top=y+"px";
});
方法二:
$(document).mousemove(function(e){
$("span").text(e.clientX + ", " + e.clientY);
var x =e.clientX;
var y = e.clientY;
$("#img").animate({"left":x,"top":y},1);
});
方法一:
$(document).mousemove(function(e){
$("span").text(e.clientX + ", " + e.clientY);
var x =e.clientX;
var y = e.clientY;
document.getElementById("img").style.left=x+"px";
document.getElementById("img").style.top=y+"px";
});
方法二:
$(document).mousemove(function(e){
$("span").text(e.clientX + ", " + e.clientY);
var x =e.clientX;
var y = e.clientY;
$("#img").animate({"left":x,"top":y},1);
});