给侧边栏添加恋爱计时功能

chen'mo
2021-04-20 / 0 评论 / 4,044 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2021年04月20日,已超过1305天没有更新,若内容或图片失效,请留言反馈。

效果如图示:

knpqjsqm.png

<section class="joe_aside__item timelife table">
<div class="joe_aside__item-title">
<i class="fa fa-heart-o icon"></i>
<span class="text">恋爱清单</span>
<span class="line"></span>
</div>
<div class="content"><br>
<div style="text-align: center;">
<img src="https://q1.qlogo.cn/g?b=sdk&amp;k=KeAYc2FhrGZhIXOplOjAXA&amp;s=100" style="width: 50px;height: 50px;vertical-align: -20px;border-radius: 50%;margin-right: 5px;margin-bottom: 5px;-webkit-box-shadow: 1px 1px 1px rgba(0,0,0,.1), 1px 1px 1px rgba(0,0,0,0.1), 1px 1px 1px rgba(0,0,0,0.1);box-shadow: 1px 1px 1px rgba(0,0,0,.1), 1px 1px 1px rgba(0,0,0,0.1), 1px 1px 1px rgba(0,0,0,0.1);border: 2px solid #fff;" title="森">
<a href="//us.arsn.cn/" target="_blank" title="恋爱清单100件"><i class="fa fa-heart us_arsn_cn" style="color:red"></i></a>
<img src="https://q1.qlogo.cn/g?b=sdk&amp;k=wUtN0RKG3VZ2NKvuiac8icFA&amp;s=100" style="width: 50px;height: 50px;vertical-align: -20px;border-radius: 50%;margin-left: 5px;margin-bottom: 5px;-webkit-box-shadow: 1px 1px 1px rgba(0,0,0,.1), 1px 1px 1px rgba(0,0,0,0.1), 1px 1px 1px rgba(0,0,0,0.1);box-shadow: 1px 1px 1px rgba(0,0,0,.1), 1px 1px 1px rgba(0,0,0,0.1), 1px 1px 1px rgba(0,0,0,0.1);border: 2px solid #fff;" title="妍"><br>
<div class="title">我们已经在一起 <span class="us_arsn_cn_font">520</span>天啦</div>
</div>
</div><br>
</section>

另一套源码:

<div class="joe_aside__item hot" style="text-align: center; color:#888; font-size: 15px; padding:10px;">
    <div style="width: 220px; margin: 0 auto;">
        <!-- 左边的头像,nk=后面填写QQ号,直接采集QQ头像 -->
        <img src="https://q1.qlogo.cn/g?b=qq&nk=209223620&s=640" alt="love"
            style="width: 60px; border-radius: 50%;">
        <!-- 中间的图片 -->
        <img src="https://cdn.jsdelivr.net/gh/aill66/cdn/love.gif" alt="love"
            style="width: 60px; border-radius: 50%;">
        <!-- 右边的头像,nk=后面填写QQ号,直接采集QQ头像 -->
        <img src="https://q1.qlogo.cn/g?b=qq&nk=209223620&s=640" alt="love"
            style="width: 60px; border-radius: 50%;">
    </div>
    <p id="lovepyqSitetime"></p>
    <script language=javascript>
        function lovepyqSitetime() {
            window.setTimeout("lovepyqSitetime()", 1000);
            var seconds = 1000
            var minutes = seconds * 60
            var hours = minutes * 60
            var days = hours * 24
            var years = days * 365
            var today = new Date()
            var todayYear = today.getFullYear()
            var todayMonth = today.getMonth() + 1
            var todayDate = today.getDate()
            var todayHour = today.getHours()
            var todayMinute = today.getMinutes()
            var todaySecond = today.getSeconds()
            // 时间设置
            var t1 = Date.UTC(2019, 10, 19, 22, 22, 00)   //年,月,日,时,分,秒
            var t2 = Date.UTC(todayYear, todayMonth, todayDate, todayHour, todayMinute, todaySecond)
            var diff = t2 - t1
            var diffYears = Math.floor(diff / years)
            var diffDays = Math.floor((diff / days) - diffYears * 365)
            var diffHours = Math.floor((diff - (diffYears * 365 + diffDays) * days) / hours)
            var diffMinutes = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours) / minutes)
            var diffSeconds = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours -
                diffMinutes * minutes) / seconds)
            document.getElementById("lovepyqSitetime").innerHTML = "我们相恋了:</br>" + diffYears + "年" + diffDays + "天" +
                diffHours + "时" + diffMinutes + "分" + diffSeconds + "秒啦"
        }
        lovepyqSitetime()
    </script>
</div>

手机上左侧添加

                                <!-- 恋爱计时 -->
        <ul class="joe_header__slideout-count">
        <div  style="font-size:15px; text-align: center; color:#888;">
        <div style="width: 220px; margin: 0 auto;">
        <!-- 左边的头像,nk=后面填写QQ号,直接采集QQ头像 -->
        <img src="https://q1.qlogo.cn/g?b=qq&nk=209223620&s=640" alt="love"
            style="width: 60px; border-radius: 50%;">
        <!-- 中间的图片 -->
        <img src="https://cdn.jsdelivr.net/gh/aill66/cdn/love.gif" alt="love"
            style="width: 60px; border-radius: 50%;">
        <!-- 右边的头像,nk=后面填写QQ号,直接采集QQ头像 -->
        <img src="https://q1.qlogo.cn/g?b=qq&nk=209223620&s=640" alt="love"
            style="width: 60px; border-radius: 50%;">
        </div>
        <p id="loveSitetime"></p>
        <script language=javascript>
        function loveSitetime() {
            window.setTimeout("loveSitetime()", 1000);
            var seconds = 1000
            var minutes = seconds * 60
            var hours = minutes * 60
            var days = hours * 24
            var years = days * 365
            var today = new Date()
            var todayYear = today.getFullYear()
            var todayMonth = today.getMonth() + 1
            var todayDate = today.getDate()
            var todayHour = today.getHours()
            var todayMinute = today.getMinutes()
            var todaySecond = today.getSeconds()
            // 时间设置
            var t1 = Date.UTC(2019, 10, 19, 22, 22, 00)  //年,月,日,时,分,秒
            var t2 = Date.UTC(todayYear, todayMonth, todayDate, todayHour, todayMinute, todaySecond)
            var diff = t2 - t1
            var diffYears = Math.floor(diff / years)
            var diffDays = Math.floor((diff / days) - diffYears * 365)
            var diffHours = Math.floor((diff - (diffYears * 365 + diffDays) * days) / hours)
            var diffMinutes = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours) / minutes)
            var diffSeconds = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours -
                diffMinutes * minutes) / seconds)
            document.getElementById("loveSitetime").innerHTML = "我们相恋了:</br>" + diffYears + "年" + diffDays + "天" +
                diffHours + "时" + diffMinutes + "分" + diffSeconds + "秒啦</br>"
        }
        loveSitetime()
        </script>
        </div>
        </ul>

参考网站:
https://www.arsn.cn/
https://blog.52aill.xyz/archives/139/

1
Typecho同步新浪微博的插件(可提取文章图片作配图)
« 上一篇 04-11
在线无损压缩图片神器Optimizilla
下一篇 » 04-28

评论 (0)

插入图片