效果:
代码:
<script type="text/javascript">
var OriginTitile = document.title,
titleTime;
document.addEventListener("visibilitychange",
function() {
if (document.hidden) {
$('[rel="shortcut icon"]').attr("href", "https://zxz.ee/usr/themes/Simple/favicon.ico";);
document.title = "你别走吖 Σ(っ °Д °;)っ";
clearTimeout(titleTime)
} else {
$('[rel="shortcut icon"]').attr("href", "https://zxz.ee/usr/themes/Simple/favicon.ico";);
document.title = "你可算回来了 (。•ˇˇ•。)" + OriginTitile;
titleTime = setTimeout(function() {
document.title = OriginTitile
},
2000)
}
});
</script>
使用:
在网页
或者之间加入上述代码即可。Emlog、typecho等要在当前主题下的head.php或者footer.php里面添加此代码
1 条评论
借用一下