/* 鼠标特效 */
var a_idx = 0;
jQuery(document).ready(function($) {
$("body").click(function(e) {
var a = new Array("❤你❤","❤真❤","❤棒❤","❤你❤","❤怎❤","❤么❤","❤这❤","❤么❤","❤好❤","❤看❤");
var $i = $("<span></span>").text(a[a_idx]);
a_idx = (a_idx + 1) % a.length;
var x = e.pageX,
y = e.pageY;
$i.css({
"z-index": 9999,
"top": y - 20,
"left": x,
"position": "absolute",
"font-weight": "bold",
"color": "rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"
});
$("body").append($i);
$i.animate({
"top": y - 180,
"opacity": 0
}, 1500, function() {
$i.remove();
});
});
});
// 修改网站标题
document.addEventListener("visibilitychange", function() {
console.log(document.visibilityState);
if(document.visibilityState == "hidden") {
document.title = '人呢?去哪了';
console.log('隐藏');
} else if (document.visibilityState == "visible") {
document.title = '欢迎回来';
console.log('显示');
setTimeout(() => {
document.title='红提柚子的博客'
}, 1000);
}
});
<!-- 修改网站标题 -->
网友评论