HTML(实现鼠标滑过留下痕迹的效果)

首先我们先要把图形打出来

<style>
        div{
            width: 10px;
            height: 10px;
            background: red;
            position: absolute;
            border-radius: 50%;
        }
    </style>

  然后写出滑动鼠标事件向那个方向移动

<script>
    document.onmousemove = function () {
        var div = document.createElement('div');
        var x = event.clientX;
        var y = event.clientY;
        div.style.left = x + "px";
        div.style.top = y + "px";
        document.body.appendChild(div);
    }
</script>

  

猜你喜欢

转载自www.cnblogs.com/fsrmyc/p/10029184.html