LikeGirl修改记录

Auth:oranger       Date:2024/12/25       Cat:教程       Word:共4422字

文章目录 「隐藏」
  1. 添加悬浮工具箱
  2. 樱花飘飘特效
  3. 点击爱心特效

添加悬浮工具箱

在各页面文件添加如下代码

<style>
    #oranger-menu {
        border-radius: 50%;
        height: 60px;
        width: 60px;
        opacity: .9;
        transition: all .3s;
        position: fixed;
        right: 5%;
        bottom: 100px;
        z-index: 999999;
        transform: scale(1);
        background-image: url(./pic/menu.svg);
        background-position: center;
        background-repeat: no-repeat;
        background-size: cover;
        }

        #oranger-menu:hover {
        opacity: 1;
        transform: scale(1.1);
        }

    .oranger-list {
        position: fixed;
        right: 5%;
        bottom: 105px;
        height: 50px;
        width: 50px;
        opacity: 0;
        text-decoration: none;
        transition: all .3s;
        z-index: 999998;
        pointer-events: none;
    }

    .oranger-list>img {

        background-color: #000;
        width: 50px;
        height: 50px;
        position: fixed;
        bottom: 105px;
        transition: all .3s;
    }

    .oranger-list_title {
        text-shadow: 0 0 2px #222;
        font-size: 20px;
        color: #777;
        transition: all .3s;
        user-select: none;
        writing-mode: vertical-rl;
        position: fixed;
        line-height: 50px;
        bottom: 170px;
        transform: all .3s;
        opacity: 0;
    }
</style>

 <script type="text/javascript">
            window.onload = () => {
                let oranger_menu = document.createElement("div");
                let oranger_lists = document.createElement("div");
                oranger_menu.setAttribute("id", "oranger-menu");
                oranger_menu.setAttribute("onclick", "clickMenu(this)");
                oranger_lists.setAttribute("id", "oranger-lists");
                document.body.appendChild(oranger_menu);
                document.body.appendChild(oranger_lists);
                const menu = document.getElementById("oranger-lists");
                const menu_list = [{
                    "title": "博客",
                    "icon": "./pic/boke.svg",
                    "href": "https://oranger.site/",
                    "target": "_blank"
                }, {
                    "title": "图床",
                    "icon": "./pic/tuchuang.svg",
                    "href": "https://image.oranger.site/",
                    "target": "_blank"
                }, {
                    "title": "云盘",
                    "icon": "./pic/yunpan.svg",
                    "href": "https://cloud.oranger.site/",
                    "target": "_blank"
                }, {
                    "title": "书签",
                    "icon": "./pic/shuqian.svg",
                    "href": "https://bk.oranger.site/",
                    "target": "_blank"
                }
                ];
                menu_list.forEach(e => {
                    let a = document.createElement("a");
                    a.innerHTML = <div class='oranger-list_title'>${e.title}</div><img style="background-color:${e.color};" src="${e.icon}" />;
                    a.setAttribute("class", "oranger-list");
                    a.setAttribute("href", e.href);
                    a.setAttribute("target", e.target);
                    a.addEventListener("mouseover", () => {
                        a.getElementsByTagName("img")[0].style.transform = "scale(1.1)";
                        a.getElementsByClassName("oranger-list_title")[0].style.opacity = 1;
                    }
                    );
                    a.addEventListener("mouseout", () => {
                        a.getElementsByTagName("img")[0].style.transform = "scale(1)";
                        a.getElementsByClassName("oranger-list_title")[0].style.opacity = 0;
                    }
                    );
                    menu.appendChild(a);
                }
                );
            }
            let clickMenu = (element) => {
                Array.from(document.getElementsByClassName("oranger-list")).forEach( (e, i) => {
                    if (e.style.opacity == 0) {
                        e.style.right = (20 + i * 56).toString() + "px";
                        e.style.opacity = .9;
                        element.style.right = (80 + i * 56).toString() + "px";
                        e.style.pointerEvents = 'auto';
                    } else {
                        e.style.right = "5%";
                        e.style.opacity = 0;
                        element.style.right = "5%";
                        e.style.pointerEvents = 'none';
                    }
                }
                );
            }
</script>

目前还有一些小问题,以后再修改

樱花飘飘特效

底部标签添加

<script src="https://love.oranger.site/js/yinghua.js"></script>

并将yinghua.js文件放在love.oranger.site/js/yinghua.js 文件夹下

下载链接:

https://cloud.oranger.site/s/K5hl

点击爱心特效

在头部标签添加

<!-- 网页鼠标点击特效 - 爱心 -->
<script type="text/javascript">
         ! function (e, t, a) {
            function r() {
                for (var e = 0; e < s.length; e++) s[e].alpha <= 0 ? (t.body.removeChild(s[e].el), s.splice(e, 1)) : (s[
                        e].y--, s[e].scale += .004, s[e].alpha -= .013, s[e].el.style.cssText = "left:" + s[e].x +
                    "px;top:" + s[e].y + "px;opacity:" + s[e].alpha + ";transform:scale(" + s[e].scale + "," + s[e]
                    .scale + ") rotate(45deg);background:" + s[e].color + ";z-index:99999");
                requestAnimationFrame(r)
            }
            function n() {
                var t = "function" == typeof e.onclick && e.onclick;
                e.onclick = function (e) {
                    t && t(), o(e)
                }
            }

            function o(e) {
                var a = t.createElement("div");
                a.className = "heart", s.push({
                    el: a,
                    x: e.clientX - 5,
                    y: e.clientY - 5,
                    scale: 1,
                    alpha: 1,
                    color: c()
                }), t.body.appendChild(a)
            }

            function i(e) {
                var a = t.createElement("style");
                a.type = "text/css";
                try {
                    a.appendChild(t.createTextNode(e))
                } catch (t) {
                    a.styleSheet.cssText = e
                }
                t.getElementsByTagName("head")[0].appendChild(a)
            }

            function c() {
                return "rgb(" + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + "," + ~~(255 * Math
                    .random()) + ")"
            }
            var s = [];
            e.requestAnimationFrame = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e
                .mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function (e) {
                    setTimeout(e, 1e3 / 60)
                }, i(
                    ".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"
                ), n(), r()
        }(window, document);

</script>

《LikeGirl修改记录》留言数:0

发表留言