b2美化之侧边栏漂亮的会员优惠倒计时

b2美化之侧边栏漂亮的会员优惠倒计时-派克资源
b2美化之侧边栏漂亮的会员优惠倒计时
此内容为付费资源,请付费后查看
7.8
立即购买
您当前未登录!建议登陆后购买,可保存购买订单
付费资源
b2美化之侧边栏漂亮的会员优惠倒计时

外观小工具,插入侧边栏自定义HTML,代码如下

[content_hide]

position: relative;
    width: 376px;
    background-image: linear-gradient(to top,#9be15d 0%,#00e3ae 100%);
    height: 180px;
    box-shadow: 0 2px 5px 0 rgb(0 0 0 / 4%);
}
.srot-mine {
    width: 100%;
    z-index: 2;
    margin-right: -5px;
}
.srot-mine-bg {
    position: absolute;
    top: 45px;
    right: 0px;
    width: 118px;
    height: 78px;
  
 
}
.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;
}
.sort-mine-wrap img {
    display: flex;
    width: auto;
}
 
.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;
}
.timer {
    z-index: 1;
    color: white;
    transform: translateY(0px);
    user-select: none;
}
.timer__content {
    display: flex;
    margin-top: 20px;
}
.timer ul li{
padding:unset;
margin-top:-8px!important;
}
.timer__item:nth-child(1) {
    animation-delay: 0.2s;
}
 
.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: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;
}
.timer_btn {
    border: 0!important;
}
 
.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 .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);
}
.timer__item:before {
    width: calc(100% - 5px);
    height: 60px;
    content: "";
    position: absolute;
    bottom: 0;
    backdrop-filter: blur(5px);
    z-index: -1;
    border-radius: 10px;
    background-color: #ffffff87;
    backdrop-filter: blur(10px);
    align-items: center;
    box-shadow: 0 3px 4px 0 rgba(0,0,0,0.2), inset 2px 4px 0 0 rgba(255,255,255,0.08);
}
.timer__name {
    color: #E91E63;
    text-transform: uppercase;
    font-weight: 600;
    font-size: 12px;
    bottom: 5px;
    right: 12px;
    position: absolute;
 
    line-height: 13px;
    text-align: center;
    letter-spacing: 0.1em;
    font-family: "Barlow Semi Condensed",sans-serif;
}
.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;
}
</style>
<script type="text/javascript">  
        //设置定时器容器
        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 = "2024/1/1 00:00:00"
        var inputTime = +new Date(str);
        //我们先调用countDown函数,可以避免在打开界面后停一秒后才开始倒计时
        if(day && hour && minute && second) {
            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)
                if(day){
                    day.innerHTML = d
                    //如果小时数小于 10,要变成 0 + 数字的形式 赋值给盒子
                    day.innerHTML = d < 10 ? "0" + d : d;
                }
                //计算小时数 转化为整数
                var h = parseInt(times / 60 / 60 % 24);
                //如果小时数小于 10,要变成 0 + 数字的形式 赋值给盒子
                if(hour){
                    hour.innerHTML = h < 10 ? "0" + h : h;
                }
                //计算分钟数 转化为整数
                var m = parseInt(times / 60 % 60);
                //如果分钟数小于 10,要变成 0 + 数字的形式 赋值给盒子
                if(minute){
                    minute.innerHTML = m < 10 ? "0" + m : m;
                }
                //计算描述 转化为整数
                var s = parseInt(times % 60);
                //如果秒钟数小于 10,要变成 0 + 数字的形式 赋值给盒子
                if(second){
                    second.innerHTML = s < 10 ? "0" + s : s;
                }
            }else{
                // 停止定时器,清空定时器
                clearInterval(countDownTimer)
            }
        }
</script>

[/content_hide]

用到的一张svg图片上传至网站根目录下pic文件夹下

 

文章版权声明 1、本网站名称:派克资源
2、本站永久网址:https://www.pknn.net
3、本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长进行删除处理。
4、本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
5、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
6、本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。
© 版权声明
THE END
喜欢就支持一下吧
点赞5 分享