像鼠标鼠标一样。
可以使用自定义图片或gif代替默认指针 对于最有可能是javascript的网页。
如果可能的话,我该如何做呢?
编辑:感谢您尝试的一些答案
http://www.javascriptkit.com/script/script2/simpleimagetrail.shtm
由于某种原因,它使得“踪迹”离我的鼠标相当远(忽略点线)
答案 0 :(得分:1)
这是我网站上的Mouse Trail的解决方案。
var dots = [],
mouse = {
x: 0,
y: 0
};
var Dot = function() {
this.x = 0;
this.y = 0;
this.node = (function(){
var n = document.createElement("div");
n.className = "MouseTrail";
document.body.appendChild(n);
return n;
}());
};
Dot.prototype.draw = function() {
this.node.style.left = this.x + "px";
this.node.style.top = this.y + "px";
};
for (var i = 0; i < 12; i++) {
var d = new Dot();
dots.push(d);
}
function draw() {
var x = mouse.x,
y = mouse.y;
dots.forEach(function(dot, index, dots) {
var nextDot = dots[index + 1] || dots[0];
dot.x = x;
dot.y = y;
dot.draw();
x += (nextDot.x - dot.x) * .6;
y += (nextDot.y - dot.y) * .6;
});
}
addEventListener("mousemove", function(event) {
mouse.x = event.pageX;
mouse.y = event.pageY;
});
function animate() {
draw();
requestAnimationFrame(animate);
}
animate();
.MouseTrail {
position: absolute;
height: 7px; width: 7px;
border-radius: 4px;
background: teal;
}
答案 1 :(得分:0)
你应该学习javascript。 这里有一些例子 simple cursor image trail