公交车上荫蒂添的好舒服的电影-公用玩物(np双xing总受)-公用小荡货芊芊-公与妇仑乱hd-攻把受做哭边走边肉楼梯play-古装一级淫片a免费播放口

LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發文檔 其他文檔  
 
網站管理員

給網站添加春節燈籠效果:引入即用,附源碼!

freeflydom
2024年11月5日 9:27 本文熱度 1543

一,引入使用

距離春節還有不到90天,趕緊試試吧!將以下JS在您的頁面直接引入即可。

   <!-- 將以下js放入您的頁面即可。text為燈籠文字,默認:新年快樂 -->
   <script src="https://www.vae.zhangweicheng.xyz/web/denglong.js?text=好好學習"> </script>

二,完整JS代碼

 // 張蘋果博客:https://zhangpingguo.com/
 // 創建并添加元素
function createDengContainer() {
    const container = document.createElement('div');
    container.className = 'deng-container';
    // 從當前腳本的 URL 獲取參數
    const scriptSrc = document.currentScript.src;
    const urlParams = new URLSearchParams(scriptSrc.split('?')[1]); // 獲取 '?'
    const customText = urlParams.get('text'); // 獲取參數名為'text'的值
    // 將獲取的文本分割為字符數組,如果沒有提供文本,則使用默認的“新年快樂”
    const texts = customText ? customText.split('') : ['新', '年', '快', '樂'];
    texts.forEach((text, index) => {
        const box = document.createElement('div');
        box.className = `deng-box deng-box${index + 1}`;
        const deng = document.createElement('div');
        deng.className = 'deng';
        const xian = document.createElement('div');
        xian.className = 'xian';
        const dengA = document.createElement('div');
        dengA.className = 'deng-a';
        const dengB = document.createElement('div');
        dengB.className = 'deng-b';
        const dengT = document.createElement('div');
        dengT.className = 'deng-t';
        dengT.textContent = text;
        dengB.appendChild(dengT);
        dengA.appendChild(dengB);
        deng.appendChild(xian);
        deng.appendChild(dengA);
        const shuiA = document.createElement('div');
        shuiA.className = 'shui shui-a';
        const shuiC = document.createElement('div');
        shuiC.className = 'shui-c';
        const shuiB = document.createElement('div');
        shuiB.className = 'shui-b';
        shuiA.appendChild(shuiC);
        shuiA.appendChild(shuiB);
        deng.appendChild(shuiA);
        box.appendChild(deng);
        container.appendChild(box);
    });
    document.body.appendChild(container);
}
// 添加CSS樣式
function addStyles() {
    const style = document.createElement('style');
    style.type = 'text/css';
    style.textContent = `
        .deng-container {
            position: relative;
            top: 10px;
            opacity: 0.9;
            z-index: 9999;
            pointer-events: none;
        }
        .deng-box {
            position: fixed;
            right: 10px;
        }
        .deng-box1 { position: fixed; top: 15px; left: 20px; }
        .deng-box2 { position: fixed; top: 14px; left: 130px; }
        .deng-box3 { position: fixed; top: 10px; right: 110px; }
        .deng {
            position: relative;
            width: 120px;
            height: 90px;
            background: rgba(216, 0, 15, .8);
            border-radius: 50% 50%;
            animation: swing 3s infinite ease-in-out;
            box-shadow: -5px 5px 50px 4px #fa6c00;
        }
        .deng-a { 
            width: 100px; 
            height: 90px; 
            background: rgba(216, 0, 15, .1); 
            border-radius: 50%;  
            border: 2px solid #dc8f03; 
            margin-left: 7px; 
            display: flex; 
            justify-content: center; 
        }
        .deng-b { 
            width: 65px; 
            height: 83px; 
            background: rgba(216, 0, 15, .1); 
            border-radius: 60%; 
            border: 2px solid #dc8f03; 
        }
        .xian { 
            position: absolute; 
            top: -20px; 
            left: 60px; 
            width: 2px; 
            height: 20px; 
            background: #dc8f03; 
        }
        .shui-a { 
            position: relative; 
            width: 5px; 
            height: 20px; 
            margin: -5px 0 0 59px; 
            animation: swing 4s infinite ease-in-out; 
            transform-origin: 50% -45px; 
            background: orange; 
            border-radius: 0 0 5px 5px; 
        }
        .shui-b { 
            position: absolute; 
            top: 14px; 
            left: -2px; 
            width: 10px; 
            height: 10px; 
            background: #dc8f03; 
            border-radius: 50%; 
        }
        .shui-c { 
            position: absolute; 
            top: 18px; 
            left: -2px; 
            width: 10px; 
            height: 35px; 
            background: orange; 
            border-radius: 0 0 0 5px; 
        }
        .deng:before, .deng:after { 
            content: " "; 
            display: block; 
            position: absolute; 
            border-radius: 5px; 
            border: solid 1px #dc8f03; 
            background: linear-gradient(to right, #dc8f03, orange, #dc8f03, orange, #dc8f03); 
        }
        .deng:before { 
            top: -7px; left: 29px; height: 14px; width: 60px; z-index: 999; 
        }
        .deng:after { 
            bottom: -7px; left: 10px; height: 14px; width: 60px; margin-left: 20px; 
        }
        .deng-t { 
            font-family: '華文行楷', Arial, Lucida Grande, Tahoma, sans-serif; 
            font-size: 3.2rem; 
            color: #dc8f03; 
            font-weight: 700; 
            line-height: 85px; 
            text-align: center; 
        }
        @media (max-width: 768px) { 
            .deng-t { font-size: 2.5rem; }  
            .deng-box { transform: scale(0.5); top: -15px; }  
            .deng-box1 { left: -22%; }  
            .deng-box2 { left: 0px; }  
            .deng-box3 { right: 50px; }  
            .deng-box4 { right: -10px; }  
        }
        @keyframes swing { 
            0% { transform: rotate(-10deg); }  
            50% { transform: rotate(10deg); }  
            100% { transform: rotate(-10deg); }  
        }
    `;
    document.head.appendChild(style);
}
// 引入時調用
function init() {
    addStyles();
    createDengContainer();
}
// 調用初始化函數
init();

三,頁面使用

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>春節燈籠</title>
</head>
<body>
    <!-- 引入js即可,text為燈籠文字,默認:新年快樂 -->
   <script src="./denglong.js?text=等著下班"> </script>
 </body></html>

四,效果圖

查看效果:燈籠效果

?轉自https://www.cnblogs.com/zhangapple/p/18520514


該文章在 2024/11/5 9:27:44 編輯過
關鍵字查詢
相關文章
正在查詢...
點晴ERP是一款針對中小制造業的專業生產管理軟件系統,系統成熟度和易用性得到了國內大量中小企業的青睞。
點晴PMS碼頭管理系統主要針對港口碼頭集裝箱與散貨日常運作、調度、堆場、車隊、財務費用、相關報表等業務管理,結合碼頭的業務特點,圍繞調度、堆場作業而開發的。集技術的先進性、管理的有效性于一體,是物流碼頭及其他港口類企業的高效ERP管理信息系統。
點晴WMS倉儲管理系統提供了貨物產品管理,銷售管理,采購管理,倉儲管理,倉庫管理,保質期管理,貨位管理,庫位管理,生產管理,WMS管理系統,標簽打印,條形碼,二維碼管理,批號管理軟件。
點晴免費OA是一款軟件和通用服務都免費,不限功能、不限時間、不限用戶的免費OA協同辦公管理系統。
Copyright 2010-2025 ClickSun All Rights Reserved

主站蜘蛛池模板: 国产xxxⅹ野性xxxxhd | 国产精品九九一区视频 | 国产三级成人 | 99精品一区二区三区无码吞精 | 91精品福利自产拍在线观看 | av在线无码专区一区 | 国产午夜精品美女视频福利 | 国产在线拍小情侣国产拍拍偷 | 精品国产一区二区三区国产馆杂枝 | 精品视频一区二区三区 | 91成人黄色视频在线观看 | 大尺码无码小黄片在线免费观看 | 91成人在线 | 国产不卡视频一区 | 成人片黄网站色大片免费观看cn | 国产无码精品一二三四区 | 2025最新无码国产在线观看 | 精品国产免费无码久久久 | 精品少妇人妻av免费久久洗澡 | 91蜜桃视 | 精品久久久久久久无码 | 91人妻无码一区二区精品免费 | 18禁止免费观看试看免费大片 | 成人精品免费网站 | 91av一区| 91成人在线视频 | 国产a级理论 | 91精品国产免费自 | 国产成人a视频高清视频在线 | 国产日韩a视频在线播放视频 | av无码中出一区 | 成人午夜一区二区三 | 国产一区二区三区正品 | 成人av免费网址在线观看 | 国产精品原创在线网址 | 国产极品美女在线观看 | av在线播放不卡播放 | 99精品久久久久中 | 国产aⅴ无码精品一品二区 国产aⅴ无码精品一区二区 | 91精品啪在线观看国产线免费 | 精品一区二区三区波多野 |