添加嗶哩嗶哩充電樣式 – B2美化

    簡(jiǎn)單的移植了下,因?yàn)?

    將嗶哩嗶哩的充電移植到B2主題的贊賞中。

    仿嗶哩嗶哩充電區(qū)塊 – WordPress區(qū)塊

    效果

    添加嗶哩嗶哩充電樣式 - B2美化
    響應(yīng)式
    • 1.1(修復(fù)了移動(dòng)端顯示錯(cuò)誤)
    • 代碼版本:1.0(發(fā)布)

    第一步,添加HTML

    找到主題根目錄下的/Modules/Templates/Single.php文件,將第567行內(nèi)容

                <div class="content-ds-button"><button @click="show()">'.__('贊賞','b2').'</button></div>

    替換為以下代碼:

                <div class="content-ds-button"  @click="show()">                    
                <div id="con">
        <div id="TA-con">
          <div id="text-con">
            <div id="linght"></div>
            <div id="TA">為T(mén)A充電</div>
          </div>
        </div>
        <div id="tube-con">
          <svg viewBox="0 0 1028 385" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M1 77H234.226L307.006 24H790" stroke="#e5e9ef" stroke-width="20" />
            <path d="M0 140H233.035L329.72 71H1028" stroke="#e5e9ef" stroke-width="20" />
            <path d="M1 255H234.226L307.006 307H790" stroke="#e5e9ef" stroke-width="20" />
            <path d="M0 305H233.035L329.72 375H1028" stroke="#e5e9ef" stroke-width="20" />
            <rect y="186" width="236" height="24" fill="#e5e9ef" />
            <ellipse cx="790" cy="25.5" rx="25" ry="25.5" fill="#e5e9ef" />
            <circle r="14" transform="matrix(1 0 0 -1 790 25)" fill="white" />
            <ellipse cx="790" cy="307.5" rx="25" ry="25.5" fill="#e5e9ef" />
            <circle r="14" transform="matrix(1 0 0 -1 790 308)" fill="white" />
          </svg>
          <div id="mask">
            <svg viewBox="0 0 1028 385" fill="none" xmlns="http://www.w3.org/2000/svg">
              <path d="M1 77H234.226L307.006 24H790" stroke="#f25d8e" stroke-width="20" />
              <path d="M0 140H233.035L329.72 71H1028" stroke="#f25d8e" stroke-width="20" />
              <path d="M1 255H234.226L307.006 307H790" stroke="#f25d8e" stroke-width="20" />
              <path d="M0 305H233.035L329.72 375H1028" stroke="#f25d8e" stroke-width="20" />
              <rect y="186" width="236" height="24" fill="#f25d8e" />
              <ellipse cx="790" cy="25.5" rx="25" ry="25.5" fill="#f25d8e" />
              <circle r="14" transform="matrix(1 0 0 -1 790 25)" fill="white" />
              <ellipse cx="790" cy="307.5" rx="25" ry="25.5" fill="#f25d8e" />
              <circle r="14" transform="matrix(1 0 0 -1 790 308)" fill="white" />
            </svg>
          </div>
          <div id="orange-mask" >
            <svg viewBox="0 0 1028 385" fill="none" xmlns="http://www.w3.org/2000/svg">
              <path d="M1 77H234.226L307.006 24H790" stroke="#ffd52b" stroke-width="20" />
              <path d="M0 140H233.035L329.72 71H1028" stroke="#ffd52b" stroke-width="20" />
              <path d="M1 255H234.226L307.006 307H790" stroke="#ffd52b" stroke-width="20" />
              <path d="M0 305H233.035L329.72 375H1028" stroke="#ffd52b" stroke-width="20" />
              <rect y="186" width="236" height="24" fill="#ffd52b" />
              <ellipse cx="790" cy="25.5" rx="25" ry="25.5" fill="#ffd52b" />
              <circle r="14" transform="matrix(1 0 0 -1 790 25)" fill="white" />
              <ellipse cx="790" cy="307.5" rx="25" ry="25.5" fill="#ffd52b" />
              <circle r="14" transform="matrix(1 0 0 -1 790 308)" fill="white" />
            </svg>
          </div>
          <!--<p id="people">共 <b>361</b> 人</p>-->
          <span id="people" v-if="data.count">共<b v-text="data.count"></b>人'.__('','b2').'</span>
          
        </div>
      </div>
      </div>

    第二步:添加CSS樣式

    在主題根目錄下的style.css文件底部添加以下CSS代碼

    /*贊賞
    版本:1.1
    */  
    /* 設(shè)置白色容器 */
      #con {
    	width: 350px;
    	height: 85px;
    	position: relative;
    	border-radius: 4px;
    	/*margin:50px auto;*/
      }
      /* 設(shè)置文本內(nèi)容容器 */
      #TA-con {
    	width: 157px;
    	height: 50px;
    	background-color: #f25d8e;
    	box-shadow: 0 4px 4px rgba(255, 112, 159, .3);
    	position: absolute;
    	top: 50%;
    	left: 5%;
    	transform: translateY(-50%);
    	border-radius: 4px;
    	cursor: pointer;
      }
      /* 設(shè)置文本居中容器 */
      #text-con {
    	width: 100px;
    	height: 100%;
    	margin: 0 auto;
    	position: relative;
      }
      /* 做一個(gè)小閃電 */
      #linght {
    	width: 0;
    	height: 0;
    	position: absolute;
    	top: 36%;
    	left: 4px;
    	border-color: transparent;
    	border-style: solid;
    	border-width: 10px;
    	border-top: 10px solid #fff;
    	border-radius: 4px;
    	transform: rotate(-55deg);
      }
      #linght::after {
    	position: absolute;
    	top: -13px;
    	left: -11px;
    	content: "";
    	width: 0;
    	height: 0;
    	border-color: transparent;
    	border-style: solid;
    	border-width: 10px;
    	border-top: 10px solid #fff;
    	transform: rotate(180deg);
    	border-radius: 4px;
      }
      /* 文字 */
      #TA {
    	float: right;
    	line-height: 50px;
    	font-size: 15px;
    	color: #fff;
      }
      #TA-con:hover {
    	background-color: #ff6b9a;
      }
    
      /* 創(chuàng)建圖形容器 */
      #tube-con {
    	width: 157px;
    	height: 55px;
    	position: absolute;
    	right: -5px;
    	top: 15px;
      }
      /* 對(duì)svg圖形設(shè)置寬高 */
      .content-ds-button svg {
    	width: 100%;
    	height: 100%;
      }
      /* 創(chuàng)建一個(gè)蒙版 寬度為0,當(dāng)我hover充電框的時(shí)候,寬度展開(kāi) */
      #mask {
    	width: 0px;
    	height: 100%;
    	overflow: hidden;
    	position: absolute;
    	top: 0;
    	left: 0;
    	transition:all 0.5s;
      }
      /* 對(duì)蒙版的sbg單獨(dú)設(shè)置寬高,保證寬度高低有一個(gè)固定值而不是百分比 */
      #mask svg {
    	width: 157px;
    	height: 55px;
      }
      /* 對(duì)充電框hover的時(shí)候開(kāi)始動(dòng)畫(huà),將粉色線條鋪開(kāi) */
      #TA-con:hover+#tube-con>#mask{
    	width:157px;
      }
      /* 對(duì)充電框hover的時(shí)候開(kāi)始動(dòng)畫(huà),添加黃色快速移動(dòng)的動(dòng)畫(huà) */
      #TA-con:hover+#tube-con>#orange-mask{
    	animation: move1 0.5s linear 0.2s infinite;
      }
      #TA-con:hover+#tube-con>#orange-mask svg{
    	animation: movetwo 0.5s linear 0.2s infinite;
      }
      /* 創(chuàng)建黃色移動(dòng)的蒙版 */
      #orange-mask{
    	width: 18px;
    	height: 100%;
    	overflow: hidden;
    	position:absolute;
    	left:-15px;
    	top:0px;
      }
      /* 創(chuàng)建黃色移動(dòng)的內(nèi)容 */
      #orange-mask svg {
    	position: absolute;;
    	top:0;
    	left:15px;
    	width: 157px;
    	height: 55px;
      }
      @keyframes move1 {
    	0%{
    	  left:-15px;
    	}
    	100%{
    	  left:140px;
    	}
      }
      @keyframes movetwo {
    	0%{
    	  left:15px;
    	}
    	100%{
    	  left:-140px;
    	}
      }
      #people{
    	position:absolute;
    	right:10px;
    	top:18px;
    	font-size:12px;
    	font-family:"雅黑";
    	color:#aaa;
      }
      #people>b{
    	color:#777;
      }
      
      @media screen and (max-width: 768px) {
          .content-ds-button { top: 0px;
        margin-top: 2em;}
          #con {
              width: 10em;
              height: auto;
              margin: 0px;
              background: #fffcf7;
          }
          
          #TA-con {
              width: 107px;
              height: 40px;
              left: 42%;
          }
          
          #linght {top: 26%;}
          #TA {line-height: 40px;margin-right: 0.4em;}
          #tube-con {display: none;}
      }

    補(bǔ)充

    替換默認(rèn)的糖果圖標(biāo),將下列代碼的圖片鏈接替換為自己的鏈接。

    /*更改圖標(biāo)*/
    .b2-tang:before {
        content: "";
        background: url(https://www.xxx.xxx/wp-content/themes/b2child-mqzj/images/dianchifang.svg) no-repeat;
        background-size: 19px 24px;
        width: 19px;
        height: 24px;
        position: absolute;
    	 margin: -26px 0px 0px -18px;
    }

    相關(guān)推薦

    添加嗶哩嗶哩充電樣式 – B2美化

    給TA贊賞
    共{{data.count}}人
    人已贊賞
    ??
    Npcink上的部份代碼及教程來(lái)源于互聯(lián)網(wǎng),僅供網(wǎng)友學(xué)習(xí)交流,若您喜歡本文可附上原文鏈接隨意轉(zhuǎn)載。
    無(wú)意侵害您的權(quán)益,請(qǐng)發(fā)送郵件至 1355471563#qq.com 或點(diǎn)擊右側(cè) 私信:Muze 反饋,我們將盡快處理。
    ?
    購(gòu)物車
    優(yōu)惠劵
    搜索
    主站蜘蛛池模板: 一区二区三区四区视频| 成人精品一区二区激情| 乱子伦一区二区三区| 久久中文字幕一区二区| 少妇无码一区二区三区免费| 一区二区三区在线免费看| 亚洲综合一区国产精品| 日韩一区二区在线免费观看| 一区二区三区观看| 日本亚洲成高清一区二区三区| 91精品一区二区综合在线| 日韩免费无码一区二区视频| 国产精品无码一区二区在线观一 | 成人区精品一区二区不卡| 国产伦精品一区二区三区| 中文字幕av一区| 精品国产一区二区三区在线观看| 风间由美性色一区二区三区| 精品国产日韩一区三区| 波多野结衣免费一区视频| 亚洲一区AV无码少妇电影| 亚洲日本中文字幕一区二区三区 | 免费高清av一区二区三区| 成人区人妻精品一区二区不卡视频 | 亚洲熟女综合一区二区三区| 一区二区三区久久精品| 无码国产精品一区二区免费| 无码精品人妻一区二区三区AV| 日韩高清国产一区在线| 一区视频在线播放| 精品日韩一区二区三区视频| 久久精品视频一区| 影院无码人妻精品一区二区| 亚洲一区在线视频| 中文字幕一区二区三区精华液 | 国产91大片精品一区在线观看| 国产成人精品一区在线| 亚洲av成人一区二区三区观看在线 | 成人国内精品久久久久一区| 性色AV一区二区三区无码| 一区二区三区国产精品 |