前提條件是開通JS權限
1、點擊頁面出現愛心
1.1、CSS代碼,復制下面到頁面定制CSS代碼里
body{ position:relative; } .img {width: 20px;height: 20px;opacity: 1;position: absolute;z-index: 100000;transition: 1s;} .left,.right {width: 10px;height: 10px;border-radius: 100%;position: absolute;} .right {right: 0;} .under {width: 10px;height: 10px;position: absolute;top: 5px;left: 5px;transform: rotate(45deg)} .text {width: 50px;font-size: 10px;line-height: 1;position: absolute;top: -1em;left: -15px;text-align: center;}
如圖:


1.2、復制js代碼到博客側邊欄公告
<script>
// 點擊出的文字數組,可自行添加,不要太多哦
text = ["你好呀~", "點我呀~", "啦啦啦~", "哎呀呀~", "求關注~", "帥哥美女~", "哦~", "咦~"];
// 計數
var count = 0;
// 鼠標按下事件
document.body.onmousedown = function (e) {
// 獲取鼠標點擊位置
var x = event.pageX - 18;
var y = event.pageY - 30;
// 分別創建所需要的元素節點
var img = document.createElement("div");
var left = document.createElement("div");
var right = document.createElement("div");
var under = document.createElement("div");
var txt = document.createElement("div");
// 通過隨機數從文字數組中獲取隨機下標的文字
var textNode = document.createTextNode(text[parseInt(Math.random() * text.length)]);
// 文字添加到txt節點中
txt.appendChild(textNode);
img.className = "img" + " " + "img" + count;
left.className = "left";
right.className = "right";
under.className = "under";
txt.className = "text";
img.style.top = y + "px";
img.style.left = x + "px";
// 將創建的元素添加到容器中
img.appendChild(left);
img.appendChild(right);
img.appendChild(under);
img.appendChild(txt);
document.body.appendChild(img);
// 獲取隨機顏色
var color = "rgb(" + parseInt(Math.random() * 255) + "," + parseInt(Math.random() * 255) + "," +
parseInt(Math.random() * 255) + ")";
txt.style.color=color;
for (var i = 0; i < 3; i++) {
img.children[i].style.background = color;
}
}
// 鼠標抬起事件
document.body.onmouseup = function () {
document.getElementsByClassName("img" + count)[0].style.transform = "scale(0.5)";
document.getElementsByClassName("img" + count)[0].style.transform = "translateY(-40px)";
document.getElementsByClassName("img" + count)[0].style.opacity = "0";
count++;
}
</script>
如圖:

保存即可!!
原文地址:https://www.cnblogs.com/2979100039-qq-con/p/12358200.html
2、點擊頁面有煙花效果
把下面代碼復制到頁腳HTML代碼處
<script src="https://blog-static.cnblogs.com/files/yjlblog/cursor-effects.js"></script> <canvas width="1366" height="662" style="position: fixed; left: 0px; top: 0px; z-index: 2147483647; pointer-events: none;"></canvas>
如圖:

原文地址:https://www.cnblogs.com/weilinxiao/p/11156533.html
3、鼠標粒子吸附特效
復制以下代碼到頁腳HTML代碼里
<script id="c_n_script" src="https://blog-static.cnblogs.com/files/xiaokang01/js.js" color="240,230,140" opacity="1" count="75" zindex="-2"> if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { } else { } </script>
原文地址:https://www.cnblogs.com/huzixia/p/10388943.html
效果圖如下:


注意:以上所有代碼均是依老虎畫貓,目前筆者還不懂那些代碼
