Loading

博客园自定义鼠标美化

1、鼠标指针替换

  • 博客设置-> 文件中上传自己的鼠标样式,上传时注意将后缀改为.ico
  • 对刚刚上传的ico文件右键->复制链接地址
  • 添加css代码

博客设置-> 设置中找到页面定制 CSS 代码,添加:

html {
    cursor: url('https://files.cnblogs.com/files/yyyzyyyz/%E6%8C%87%E9%92%88.ico'), auto;
}

2、鼠标动态效果

鼠标点击效果Js代码:

<script type="text/javascript">
/* 鼠标特效 */
var a_idx = 0;
jQuery(document).ready(function($) {
    $("body").click(function(e) {
        var a = new Array("❤感谢观看❤","❤","❤喜欢就点个赞呗❤","❤❤","❤快去点赞❤","❤❤❤","❤不是点这里哦❤","❤❤","❤点赞在底部啦❤","❤","❤❤");
        var $i = $("<span></span>").text(a[a_idx]);
        a_idx = (a_idx + 1) % a.length;
        var x = e.pageX,
        y = e.pageY;
        $i.css({
            "z-index": 999999999999999999999999999999999999999999999999999999999999999999999,
            "top": y - 20,
            "left": x,
            "position": "absolute",
            "font-weight": "bold",
            "color": "rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"
        });
        $("body").append($i);
        $i.animate({
            "top": y - 180,
            "opacity": 0
        },
        1500,
        function() {
            $i.remove();
        });
    });
});
</script>

开源鼠标特效地址:https://github.com/shuiche-it/cnblog-mouse

posted @ 2021-10-09 07:20  yyyz  阅读(1373)  评论(3编辑  收藏  举报