当前位置:首页>网站教程>7B2主题美化>7b2美化-首页添加导航会员区块(二)倒计时

7b2美化-首页添加导航会员区块(二)倒计时

国庆节到了,难免网站都会有一些优惠活动,首页导航区块倒计时版本。

国庆节倒计时

以下代码放入后台-模块管理-自定义

<!-- 区块代码 开始 -->
<div class="home-row-left content-area mobile-hidden"> 
    <div class="sort jitheme_radius" style="margin-top:-100px ;">    
        <ul class="sort-config"> 
            <li>
                                    <div class="sort-config-item">
                                    <img class="sort-config-icon" src="/pic/bb1.svg" alt="" />
                                    <a href="#" target="_blank"><p class="sort-config-title">国庆特价
                                    
                                    </p> </a>
                                    <span class="sort-config-desc">买即送年卡会员</span>
                                    </div></li> <li>
                                    <div class="sort-config-item">
                                    <img class="sort-config-icon" src="/pic/bb2.svg" alt="" />
                                    <a href="#" target="_blank"><p class="sort-config-title">教程分享
                                    
                                    </p> </a>
                                    <span class="sort-config-desc">整理7B2美化教程</span>
                                    </div></li> <li>
                                    <div class="sort-config-item">
                                    <img class="sort-config-icon" src="/pic/bb3.svg" alt="" />
                                    <a href="#" target="_blank"><p class="sort-config-title">指导服务
                                    
                                    </p> </a>
                                    <span class="sort-config-desc">尊享指导安装服务</span>
                                    </div></li> <li>
                                    <div class="sort-config-item">
                                    <img class="sort-config-icon" src="/pic/bb4.svg" alt="" />
                                    <a href="#" target="_blank"><p class="sort-config-title">美化建议
                                    
                                    </p> </a>
                                    <span class="sort-config-desc">收集好的美化建议</span>
                                    </div></li> <li>
                                    <div class="sort-config-item">
                                    <img class="sort-config-icon" src="/pic/bb5.svg" alt="" />
                                    <a href="#" target="_blank"><p class="sort-config-title">问题反馈
                                    
                                    </p> </a>
                                    <span class="sort-config-desc">发现bug,立即反馈</span>
                                    </div></li>                 </ul> 
                                    <div class="sort-blocks"> 
            <div class="bt-body"> 
                <div class="containerrr"> 
                    <div class="onecad-quk-carousel"> 
                        <div class="itemss"> 
                            <a class="card_ZQsT- b2-radius" href="#" target="_blank">
                                                                <img src="/pic/djs1.jpg">
                                                                <div class="title_3qCGt">展示一</div> 
                                                                <div class="tipss jiaobiao_color1">精品</div>
                                                            </a><a class="card_ZQsT- b2-radius" href="#" target="_blank">
                                                                <img src="/pic/djs2.jpg">
                                                                <div class="title_3qCGt">展示二</div> 
                                                                <div class="tipss jiaobiao_color4">推荐</div>
                                                            </a><a class="card_ZQsT- b2-radius" href="#" target="_blank">
                                                                <img src="/pic/djs3.jpg">
                                                                <div class="title_3qCGt">展示三</div> 
                                                                <div class="tipss jiaobiao_color6">广告</div>
                                                            </a><a class="card_ZQsT- b2-radius" href="#" target="_blank">
                                                                <img src="/pic/djs4.jpg">
                                                                <div class="title_3qCGt">展示四</div> 
                                                                <div class="tipss jiaobiao_color6">广告</div>
                                                            </a>                                </div> 
                    </div> 
                </div> 
            </div> 
            <div class="srot-mine b2-radius" style="background: linear-gradient(90deg,#fdf8eb,#feeec3);"> 
                <i class="srot-mine-bg"></i> 
                <div class="sort-mine-wrap">
                        <div class="srot-mine-tit">
                            <img src="/pic/vipiconhover.svg" alt="" class="srot-mine-ava" /> 
                            <span>迎国庆,终身会员八折,限时结束</span>
                        </div><body onload="countTime()" >
                           <div class="timer">
                              <ul class="timer__content">
                                 <li class="timer__item">
                                    <p id="_d_mc" class="timer__name">天</p>
                                    <span id="_d" class="timer__number">12</span>
                                 </li>
                                 <li class="timer__item">
                                    <p id="_h_mc" class="timer__name">时</p>
                                    <span id="_h" class="timer__number">12</span>
                                 </li>
                                 <li id="_m_mc" class="timer__item">
                                    <p class="timer__name">分</p>
                                    <span id="_m" class="timer__number">40</span>
                                 </li>
                                 <li class="timer__item">
                                    <p id="_s_mc" class="timer__name">秒</p>
                                    <span id="_s" class="timer__number">16</span>
                                 </li>
                              </ul>
                                 <a href="/vips" class="timer_btn">
                                     点我购买
                                     <div class="timer_btn_jb">
                                     仅需88元
                                     </div>
                                 </a>
                           </div>
                        </body></div>                        
            </div> 
        </div> 
                    </div>
</div>
<!-- 区块代码结束 -->

以下代码放入7b2字主题的style.css样式

/*首页倒计时模块开始*/
.sort-config-title .go {
    border-radius: 4px;
    color: #ffffff;
    font-size: 13px;
    -webkit-transform: scale(.9);
    -ms-transform: scale(.9);
    transform: scale(.9);
    font-weight: normal;
    padding: 2px 5px;
    position: absolute;
    line-height: 15px;
    margin-left: 5px;
    cursor: pointer;
    text-transform: uppercase;
    vertical-align: middle;
    margin-top: 7px;
}
.sort-blocks {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    height: 100%;
    margin-top: 35px;
}
.sort-blocks-item {
    position: relative;
    overflow: hidden;
    width: 214px;
    height: 100%;
    background: #f7f9fa;
    border-radius: 14px;
}
.sort-blocks-item .blocks-item-wrap {
    -webkit-transition: .3s;
    transition: .3s;
    -webkit-filter: none;
    filter: none;
}
.sort-blocks-icon {
    display: block;
    width: 60px;
    height: 47px;
    margin: 18px auto 15px;
    background-repeat: no-repeat;
    background-size: cover;
}
.sort-blocks-title {
    line-height: 22px;
    font-size: 22px;
    font-weight: 600;
    color: #2d2d2d;
    letter-spacing: 1px;
    text-align: center;
}

.sort-blocks-item .blocks-hover, .sort-blocks-item .blocks-hover-title {
    position: absolute;
    top: 0;
    width: 100%;
    color: #fff;
    text-align: center;
    line-height: 22px;
}
.sort-blocks-item .blocks-hover {
    left: 0;
    height: 100%;
    padding-top: 22px;
    font-size: 14px;
    background: rgba(0,0,0,.4);
    -webkit-transition: .3s;
    transition: .3s;
    opacity: 0;
}
.sort-blocks-item .blocks-hover-tit {
    line-height: 18px;
    font-size: 18px;
}
.sort-blocks-item .blocks-hover-line {
    width: 158px;
    height: 1px;
    margin: 12px auto 8px;
    background: -webkit-gradient(linear,left top,right top,from(hsla(0,0%,100%,0)),color-stop(30%,hsla(0,0%,100%,.7)),color-stop(70%,hsla(0,0%,100%,.7)),to(hsla(0,0%,100%,.1)));
    background: linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.7) 30%,hsla(0,0%,100%,.7) 70%,hsla(0,0%,100%,.1));
}
.bt-body {
    padding-bottom: 0px;
    background: transparent;
    width: calc(100% - 376px);
}
.containerrr .itemss a {
    display: inline-block;
    margin-right: 16px;
    width: calc(25% - 16px);
    height: 180px;
    text-align: center;
}
.card_ZQsT- .title_3qCGt {
    font-size: 14px;
    color: #222222;
    height: 35px;
    background-color: #fff;
    line-height: 35px;
    width: 100%;
    position: absolute;
    display: block;
    margin-top: -35px;
}
.card_ZQsT- img{
    height: 180px;
    width: 100%;
}

.card_ZQsT- {
    height: 192px;
    width: 128px;
    display: inline-block;
    vertical-align: top;
    cursor: pointer;
    white-space: normal;
    box-shadow: 0 2px 5px 0 rgb(0 0 0 / 4%);
    background: #FFFFFF;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    padding: 0px 0 16px 0;
    margin-right: 16px;
    text-decoration: none;
    transition: all 0.3s;
}
/*角标CSS*/
.jiaobiao_color1{
    color:#fff;
    background-color:#03bbff;
}
.jiaobiao_color2{
    color:#fff;
    background-color:#ca26ff;
}
.jiaobiao_color3{
    color:#fff;
    background-color:#7bdcb5;
}
.jiaobiao_color4{
    color:#fff;
    background-color:#ff2a8e;
}
.jiaobiao_color5{
    color:#fff;
    background-color:#ff8f21;
}
.jiaobiao_color6{
    color:#fff;
    background-color:#00ce41;
}
.srot-mine {
    position: relative;
    width: 376px;
    background-image: linear-gradient(to top, #9be15d 0%, #00e3ae 100%);
    /*background: -webkit-gradient(linear,left top,right top,from(#fdf8eb),to(#feeec3));*/
    /*background: linear-gradient(90deg,#fdf8eb,#feeec3);*/
    height: 180px;
    box-shadow: 0 2px 5px 0 rgb(0 0 0 / 4%);
}
.srot-mine-bg {
    position: absolute;
    top: 13px;
    right: -13px;
    width: 118px;
    height: 78px;

    background-size: cover;
}
.sort-mine-wrap {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    padding: 12px 16px 15px;
}
.srot-mine-tit {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    line-height: 25px;
}
.srot-mine-ava {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}
.srot-mine-tit>span {
    margin-left: 9px;
    font-size: 15px;
    font-weight: 600;
    color: #613c14;
}
.srot-mine-vips {
    display: flex;
    -webkit-box-pack: justify;
    justify-content: space-between;
    width: 337px;
    margin: 15px 0px 5px;
}
.sort-vips-item {
    display: block;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    text-align: center;
}
.sort-vips-icon {
    display: block;
    width: 32px;
    height: 36px;
    margin: 0 auto;
    -webkit-transition: .3s;
    transition: .3s;
    margin-left: 30px;
}
.sort-vips-tit {
    margin: 15px 0px;
    line-height: 12px;
    font-size: 13px;
    color: #613c14;
    margin-left: 10px;
}
.sort-vips-tit2-kt {
    margin-top: 10px;
    line-height: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 25px;
    color: #ffffff;
    border-radius: 33px;
    margin-right: 10px;
    font-size: 14px;
    background-image: linear-gradient(90deg,#ffc046,#ff7d04);
    margin: 10px 0px 0px 9px;

}
.sort-mine-wrap img {
    display: flex;
    width: auto;
}
 .timer {
    z-index: 1;
    color: white;
    transform: translateY(0px);
    user-select: none;
  }
  @media screen and (max-width: 512px) {
    .timer {
      transform: translateY(-10px);
    }
  }
  .timer__content {
    display: flex;
        margin-top: 20px;
  }
  .timer__item {
    display: flex;
    width: 25%;
    color: #f35;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    animation: item 0.6s ease backwards;
    position: relative;
    transition: all 1s 0.2s ease;
  }
  .timer__item:hover {
    transition: all 0.3s ease;
    transform: translateY(-0px);
  }
  @media screen and (max-width: 799px) {
    .timer__item:hover {
      transform: translateY(0px);
    }
  }
  .timer__item:nth-child(1) {
    animation-delay: 0.2s;
  }
  .timer__item:nth-child(2) {
    animation-delay: 0.4s;
  }
  .timer__item:nth-child(3) {
    animation-delay: 0.6s;
  }
  .timer__item:nth-child(4) {
    animation-delay: 0.8s;
  }
  @keyframes item {
    0% {
      opacity: 0;
      transform: translateY(40px);
    }
  }
  .timer__item:before {
    width: calc(100% - 20px);
    height: 60px;
    content: "";
    position: absolute;
    /* color: #009688; */
    bottom: 0;
    backdrop-filter: blur(5px);
    z-index: -1;
    border-radius: 10px;
    background-color: #ffffff87;
    backdrop-filter: blur(10px);
    align-items: center;
    /* border-radius: 0px 0px 10px 10px; */
    /* box-shadow: 0px 5px 40px 0px rgba(17,58,93,.1); */
    /* background-color: #F44336; */
    box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.2), inset 2px 4px 0 0 rgba(255, 255, 255, 0.08);
  }
  @media screen and (max-width: 799px) {
    .timer__item:before {
      height: 80px;
    }
  }
  @media screen and (max-width: 512px) {
    .timer__item:before {
      width: calc(100% - 10px);
      height: 60px;
      border-radius: 5px;
    }
  }
  .timer__name {
    /* margin-bottom: 10px; */
    color: #E91E63;
    text-transform: uppercase;
    font-weight: 600;
    font-size: 12px;
    /* width: 30px; */
    /* height: 30px; */
    bottom: 0px;
    /* background-color: #fff; */
    right: 12px;
    /* box-shadow: 0 3px 4px 0 rgb(0 0 0 / 24%), inset 2px 4px 0 0 rgba(255, 255, 255, 0.08); */
    position: absolute;
    border: 3px solid #f5f6f71a;
    border-radius: 50%;
    line-height: 13px;
    text-align: center;
    letter-spacing: 0.1em;
    font-family: "Barlow Semi Condensed", sans-serif;
  }
  @media screen and (max-width: 799px) {
    .timer__name {
      font-size: 14px;
    }
  }
  .timer__number {
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 30px;
    text-align: center;
    letter-spacing: 2px;
    animation: number 0.4s 1.4s ease backwards;
  }
  @media screen and (max-width: 799px) {
    .timer__number {
      width: 80px;
      height: 80px;
      font-size: 40px;
    }
  }
  @media screen and (max-width: 512px) {
    .timer__number {
      width: 60px;
      height: 60px;
      font-size: 28px;
    }
  }
  @keyframes number {
    0% {
      opacity: 0;
      transform: scale(0.5);
    }
  }
  .timer__text {
    font-weight: 400;
    font-size: 20px;
    color: #E91E63;
    line-height: 20px;
    /* letter-spacing: 0.3em; */
    text-align: center;
padding-bottom: 20px;
    padding-top: 20px;
  }
  @media screen and (max-width: 799px) {
    .timer__text {
      font-size: 16px;
    }
  }
  @media screen and (max-width: 512px) {
    .timer__text {
      margin-top: 30px;
    }
  }
  .timer_btn {
    position: relative;
    width: 152px;
    height: 32px;
    background-image: linear-gradient(134deg,#4d5580,#3d4466);
    font-size: 14px;
    color: #fff3eb;
    font-weight: 600;
    margin-top: 20px;
    margin: 20px auto 0px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.timer_btn{
    border: 0!important;
}
.timer_btn:hover {
	background-image:linear-gradient(134deg,rgba(77,85,128,.9),rgba(61,68,102,.9));
}
.timer_btn:active {
	background-image:linear-gradient(134deg,rgba(77,85,128,.8),rgba(61,68,102,.8));
}
.timer_btn .timer_btn_jb {
	top:-14px;
	right:-54px;
	position:absolute;
	background-image:linear-gradient(90deg,#ff9580,#f36);
	border-radius:6px;
	color:#fff;
	letter-spacing:0;
	text-align:center;
	font-weight:100;
	padding:2px 8px;
	font-size:20px;
	-webkit-transform:scale(.5);
	transform:scale(.5);
}
.sort-vips-tit2-wk {
    margin-top: 10px;
    line-height: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 25px;
    color: #ffffff;
    border-radius: 33px;
    margin-right: 10px;
    font-size: 14px;
    opacity: 0.5;
    background: linear-gradient(to bottom, #323232 0%, #3F3F3F 40%, #1C1C1C 150%), linear-gradient(to top, rgba(255,255,255,0.40) 0%, rgba(0,0,0,0.25) 200%); background-blend-mode: multiply;
    margin: 10px 0px 0px 9px;
}
.tipss,.meta-post-type {
    position: absolute;
    top: 0px;
    right: 0px;
    z-index: 1;
    padding: 0px 5px;
    height: 20px;
    color: #fff;
    line-height: 20px;
    /*-webkit-transform: rotate(45deg);*/
    /*transform: rotate(45deg);*/
    text-align: center;
    font-size: 12px;
}
.yellow {
    background-color: var(--b2color);
}
.card_ZQsT-:hover {
    display: inline-block;
    vertical-align: top;
    cursor: pointer;
    white-space: normal;
    box-shadow: 0 2px 5px 0 rgb(0 0 0 / 4%);
    background: #FFFFFF;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    padding: 0px 0 16px 0;
    margin-right: 16px;
    text-decoration: none;
    transform: translateY(-3px);
}
.card_ZQsT- .year-tag_3Iqeg {
    height: 19px;
    min-width: 52px;
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
    position: absolute;
    top: 6px;
    left: 6px;
    text-align: center;
    line-height: 19px;
    font-size: 12px;
    color: #FFFFFF;
    box-sizing: border-box;
    padding: 0 8px;
    border-radius: 10px;
}
.onecad-quk-carousel .itemss {
	white-space: nowrap;
	width: 100%;
	display: flex;
	-webkit-overflow-scrolling: touch;
    -webkit-box-pack: justify;
    -moz-box-pack: justify;
    justify-content: space-between;
}
.onecad-quk-carousel .itemss::-webkit-scrollbar {
	display: none;
}
ul {
    display: block;
    list-style-type: disc;
    margin-block-start: 1em;
    margin-block-end: 1em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    padding-inline-start: 40px;
}
.sort-config>li {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    overflow: hidden;
    height: 100%;
}
.sort, .jitheme_slide_jb, .jitheme_radius {
    border-radius: 20px;
}

.jitheme_slide_n ol, ul, li {
    list-style: none;
}

.sort-config-title {
    line-height: 34px;
    font-size: 18px;
    font-weight: 600;
    color: #2d2d2d;
    -webkit-transition: .3s;
    transition: .3s;
}
.sort {
    position: relative;
    z-index: 1;
    padding: 26px;
    background: #fff;
    /* border: 1px solid #797c80; */
    /* -webkit-box-shadow: 0 40px 75px 0 rgba(57,60,67,.08); */
    /* box-shadow: 0 40px 75px 0 rgba(57,60,67,.08); */
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.sort-config-desc {
    float: left;
    line-height: 22px;
    font-size: 14px;
    color: #8e8e8e;
}
.sort-config {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
}
.sort-config-item {
    display: block;
    height: 100%;
}
.sort-config-item img {
    float: left;
    width: 62px;
    height: 62px;
    margin-right: 12px;
}
/*首页倒计时模块结束*/

以下代码放入子主题的child.js内

//设置定时器容器
var countDownTimer = null ;
//获取元素
var day =  document.getElementById("_d");
var hour = document.getElementById("_h");
var minute = document.getElementById("_m");
var second = document.getElementById("_s");
//获取截止时间的时间戳(单位毫秒)
var str = "2022/10/08 00:00:00"
var inputTime = +new Date(str);
//我们先调用countDown函数,可以避免在打开界面后停一秒后才开始倒计时
countDown();
//定时器 每隔一秒变化一次
countDownTimer =  setInterval(countDown, 1000);
function countDown() {
    //获取当前时间的时间戳(单位毫秒)
    var nowTime = +new Date();
    //把剩余时间毫秒数转化为秒
    var times = (inputTime - nowTime) / 1000;
    if(times > 0){
         //计算天数
        var d = Math.floor(times/60/60/24)
        day.innerHTML = d
        //如果小时数小于 10,要变成 0 + 数字的形式 赋值给盒子
        day.innerHTML = d < 10 ? "0" + d : d;
        //计算小时数 转化为整数
        var h = parseInt(times / 60 / 60 % 24);
        //如果小时数小于 10,要变成 0 + 数字的形式 赋值给盒子
        hour.innerHTML = h < 10 ? "0" + h : h;
        //计算分钟数 转化为整数
        var m = parseInt(times / 60 % 60);
        //如果分钟数小于 10,要变成 0 + 数字的形式 赋值给盒子
        minute.innerHTML = m < 10 ? "0" + m : m;
        //计算描述 转化为整数
        var s = parseInt(times % 60);
        //如果秒钟数小于 10,要变成 0 + 数字的形式 赋值给盒子
        second.innerHTML = s < 10 ? "0" + s : s;
        // console.log(d+'天'+h+'时'+m+'分'+s+'秒')
    }else{
        // 停止定时器,清空定时器
        clearInterval(countDownTimer)
    }
}

最后下载图片上传根目录-然后更新你的缓存插件浏览器缓存

下载权限

查看
  • 免费下载
    评论并刷新后下载
    登录后下载

查看演示

  • {{attr.name}}:
您当前的等级为
登录后免费下载登录 小黑屋反思中,不准下载! 评论后刷新页面下载评论 支付以后下载 请先登录 您今天的下载次数(次)用完了,请明天再来 支付积分以后下载立即支付 支付以后下载立即支付 您当前的用户组不允许下载升级会员
您已获得下载权限 您可以每天下载资源次,今日剩余

给TA赞助
共{{data.count}}人
人已赞助
5 条回复 A文章作者 M管理员
  1. user230

    ?

  2. user230

    ddd

  3. 'ZhaoHuan

    极霸矛,湘阿痕响啊。

  4. 1234

    我们一路奋战,不是为了改变世界,而是为了不让世界改变我们。

  5. 你仔细听

    我也想杀死伤痛,让那恩怨有始有终。

个人中心
购物车
优惠劵
搜索