给博客添加时间倒计时插件

博客添加时间倒计时,适用于全部主题,,一般在侧栏最好看,根据主题自行放在合适位置

引入第三方库jquery

首先需要去引入第三方库jquery,这个主题一般都有,没有的话,在主题的header.php引入以下

<script src=”http://libs.baidu.com/jquery/1.9.1/jquery.min.js”></script>

添加CSS样式代码

.aside-count .content {
    padding: 15px
}
 
.aside-count .content .item {
    margin-bottom: 15px
}
 
.aside-count .content .item:last-child {
    margin-bottom: 0
}
 
.aside-count .content .item .title {
    font-size: 12px;
    color: var(--minor);
    margin-bottom: 5px;
    display: flex;
    align-items: center
}
 
.aside-count .content .item .title span {
    color: var(--theme);
    font-weight: 500;
    font-size: 14px;
    margin: 0 5px
}
 
.aside-count .content .item .progress {
    display: flex;
    align-items: center
}
 
.aside-count .content .item .progress .progress-bar {
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    background: var(--classC);
    width: 0;
    min-width: 0;
    flex: 1;
    margin-right: 5px
}
@keyframes progress {
    0% {
        background-position: 0 0
    }
 
    100% {
        background-position: 30px 0
    }
}
.aside-count .content .item .progress .progress-bar .progress-inner {
    width: 0;
    height: 100%;
    border-radius: 5px;
    transition: width 0.35s;
    -webkit-animation: progress 750ms linear infinite;
    animation: progress 750ms linear infinite
}
 
.aside-count .content .item .progress .progress-bar .progress-inner-1 {
    background: #bde6ff;
    background-image: linear-gradient(135deg, #50bfff 25%, transparent 25%, transparent 50%, #50bfff 50%, #50bfff 75%, transparent 75%, transparent 100%);
    background-size: 30px 30px
}
 
.aside-count .content .item .progress .progress-bar .progress-inner-2 {
    background: #ffd980;
    background-image: linear-gradient(135deg, #f7ba2a 25%, transparent 25%, transparent 50%, #f7ba2a 50%, #f7ba2a 75%, transparent 75%, transparent 100%);
    background-size: 30px 30px
}
 
.aside-count .content .item .progress .progress-bar .progress-inner-3 {
    background: #ffa9a9;
    background-image: linear-gradient(135deg, #ff4949 25%, transparent 25%, transparent 50%, #ff4949 50%, #ff4949 75%, transparent 75%, transparent 100%);
    background-size: 30px 30px
}
 
.aside-count .content .item .progress .progress-bar .progress-inner-4 {
    background: #67c23a;
    background-image: linear-gradient(135deg, #4f9e28 25%, transparent 25%, transparent 50%, #4f9e28 50%, #4f9e28 75%, transparent 75%, transparent 100%);
    background-size: 30px 30px
}

添加组件代码

<div class="widget_text aside-box widget_custom_html"><h2 class="widget-title">似水流年</h2>
<div class="textwidget custom-html-widget"> <div class="aside aside-count">
        <div class="p-3"><span style="font-size: 1.2em; color: orange;"><i class="fas fa-hourglass-half"></i></span> 人生倒计时</div>
        <div class="content">
            <div class="item" id="dayProgress">
                <div class="title">今日已经过去<span>19</span>小时</div>
                <div class="progress">
                    <div class="progress-bar">
                        <div class="progress-inner progress-inner-1" style="width: 80%;"></div>
                    </div>
                    <div class="progress-percentage">80%</div>
                </div>
            </div>
            <div class="item" id="weekProgress">
                <div class="title">这周已经过去<span>2</span>天</div>
                <div class="progress">
                    <div class="progress-bar">
                        <div class="progress-inner progress-inner-2" style="width: 28%;"></div>
                    </div>
                    <div class="progress-percentage">28%</div>
                </div>
            </div>
            <div class="item" id="monthProgress">
                <div class="title">本月已经过去<span>15</span>天</div>
                <div class="progress">
                    <div class="progress-bar">
                        <div class="progress-inner progress-inner-3" style="width: 50%;"></div>
                    </div>
                    <div class="progress-percentage">50%</div>
                </div>
            </div>
            <div class="item" id="yearProgress">
                <div class="title">今年已经过去<span>11</span>个月</div>
                <div class="progress">
                    <div class="progress-bar">
                        <div class="progress-inner progress-inner-4" style="width: 91%;"></div>
                    </div>
                    <div class="progress-percentage">91%</div>
                </div>
            </div>
        </div>
    </div>
<script src="https://cdn.qqsuu.cn/static/time.js"></script></div></div>

 

|| 版权声明
作者:大米
链接:https://blog.qqsuu.cn/4330.html
声明:如无特别声明本文即为原创文章仅代表个人观点,版权归《大米博客》所有,欢迎转载,转载请保留原文链接。
THE END
分享
二维码
给博客添加时间倒计时插件
博客添加时间倒计时,适用于全部主题,,一般在侧栏最好看,根据主题自行放在合适位置 引入第三方库jquery 首先需要去引入第三方库jquery,这个主题一般都有……
<<上一篇
下一篇>>