网站添加人生倒计时小插件源码 第5张插图
博客添加时间倒计时,适用于全部主题,看你添加在哪里了,一般在侧栏最好看,根据主题自行放在合适位置即可。

演示图

网站添加人生倒计时小插件源码 第6张插图
1、引入JQ文件
首先需要去引入第三方库jquery,这个主题一般都有,没有的话,在主题的header.php引入以下。

<script src="http://libs.baidu.com/jqueryui/1.9.1/jquery-ui.min.js"></script>

2、定义CSS样式
然后把以下css样式放入主题的style.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
}

3、定义JS样式
之后引入以下js,具体是自建js引入还是放在主题的js文件里,自己请随意发挥。