前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >低仿lusaxweb鼠标

低仿lusaxweb鼠标

作者头像
阿超
发布2022-12-16 15:15:26
2280
发布2022-12-16 15:15:26
举报
文章被收录于专栏:快乐阿超

幸福的婚姻生活,往往会被卑鄙的勾当、阴险的猜忌所破坏。——莎士比亚

这是 http://lusaxweb.net/

它的鼠标很有意思,是一个圈,能够反色,我们低仿一个

代码如下:

代码语言:javascript
复制
<!DOCTYPE html>
<html>

<head>
    <style>
        * {
            margin: 0;
            padding: 0;
            cursor: none;
        }

        .img {
            height: 80vh;
            width: 80vw;
            overflow: hidden;
        }

        .img:hover~#cursor-pointer {
            background-color: white;
        }

        #cursor-circle {
            pointer-events: none;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            border: 1px solid black;
            background: white;
            mix-blend-mode: exclusion;
            position: absolute;
            transition: .1s all;
        }

        #cursor-pointer {
            pointer-events: none; 
            width: 4px;
            height: 4px;
            border-radius: 50%;
            position: absolute;
            background-color: black;
        }
    </style>
</head>

<body>
    <div class="container">
        <img class="img" src="https://vampireachao.gitee.io/imgs/preview/3131_3.jpg" />
        <div id="cursor-circle"></div>
        <div id="cursor-pointer"></div>
    </div>
    <script>
        const cursorCircle = document.querySelector("#cursor-circle")
        const cursorPointer = document.querySelector("#cursor-pointer")
        window.addEventListener('mousemove', e => {
            cursorPointer.style.top = document.documentElement.scrollTop + e.clientY - 1 + 'px'
        cursorPointer.style.left = document.documentElement.scrollLeft + e.clientX - 1 + 'px'
        cursorCircle.style.top = document.documentElement.scrollTop + e.clientY - 12 + 'px'
        cursorCircle.style.left = document.documentElement.scrollLeft + e.clientX - 12 + 'px'
        })
    </script>
</body>

</html>

效果如下:

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-12-15,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档