我通过鼠标位置在窗口上用 CSS 绘制圆圈。然后我慢慢地移动光标,很好地重绘,但如果我更快地移动光标,我可以看到圆圈是如何消失的。我怎样才能在不消失的情况下顺利重绘?
我的代码我在下面尝试:
.circle {
position: absolute;
width:100px;
height:100px;
border-radius:50px;
border: 1px solid #000
}
<div class="circle"> </div>
$(window).mousemove(function(e) {
var x = e.clientX;
var y = e.clientY;
$(".circle").css("left", x-50); //-50 for center because circle width = 100
$(".circle").css("top", y-50); //-50 for center because circle height = 100
});