闲谈(一)博客常用工具-JavaScript

1,雪花特效

<!--雪花特效-->
<script type="text/javascript" src="https://libs.baidu.com/jquery/1.8.3/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/TRHX/[email protected]/js/snow3.js"></script>
<script src="https://cdn.jsdelivr.net/gh/TRHX/[email protected]/js/snow.js"></script>

2,打字烟花特效

<!--打字烟花特效-->
<script src="https://cdn.jsdelivr.net/gh/SGYZ0910/[email protected]/js/activate-power-mode.js"></script>
<script>
POWERMODE.colorful = true; // make power mode colorful
POWERMODE.shake = false; // turn off shake
document.body.addEventListener('input', POWERMODE);
</script>

3,鼠标点击爱心特效

<!--鼠标点击爱心特效-->
<script src="https://cdn.jsdelivr.net/gh/SGYZ0910/[email protected]/js/love.js"></script>

4,标题转换

<!--标题切换特效-->
<script>
var OriginTitle = document.title;
var titleTime;
document.addEventListener('visibilitychange', function () {
if (document.hidden) {
$('[rel="icon"]').attr('href', "/favicon.ico");
document.title = '╭(°A°`)╮ 404,页面崩溃啦 ~';
clearTimeout(titleTime);
}
else {
$('[rel="icon"]').attr('href', "/favicon.ico");
document.title = '(ฅ>ω<*ฅ) 欢迎回来 ~' + OriginTitle;
titleTime = setTimeout(function () {
document.title = OriginTitle;
}, 2000);
}
});
</script>

5,自定义文字鼠标点击特效

<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
        /* 鼠标点击特效 - 7Core.CN */
        var a_idx = 0;jQuery(document).ready(function($) {$("body").click(function(e) {var a = new Array("富强", "民主", "文明", "和谐", "自由", "平等", "公正" ,"法治", "爱国", "敬业", "诚信", "友善");var $i = $("<span/>").text(a[a_idx]);
        a_idx = (a_idx + 1) % a.length;var x = e.pageX,y = e.pageY;$i.css({"z-index": 100000000,"top": y - 20,"left": x,"position": "absolute","font-weight": "bold","color": "#ff6651"});$("body").append($i);$i.animate({"top": y - 180,"opacity": 0},1500,function() {$i.remove();});});});
</script>

存在sakura-common-header封装。

正文完