选项卡欺骗提示
网页选项卡切换提示
代码语言:javascript复制/**
* 状态栏判断
*/
function judgeState() {
var OriginTitle = document.title;
var titleTime;
document.addEventListener('visibilitychange', function () { //浏览器切换事件
if (document.visibilityState === 'hidden') { //状态判断
document.title = ' (╥﹏╥) 你快回来 ~ ';
clearTimeout(titleTime);
} else {
document.title = ' (∩_∩) 欢迎回来 ~ ' OriginTitle;
titleTime = setTimeout(function () {
document.title = OriginTitle;
}, 1500);
}
});
console.log('%c欢迎来到DoubleAm的主页 ~ ', 'background:chocolate;border:1px solid tomato;border-radius:10px;box-sizing:border-box;color:yellow;font-size:26px;padding:13px;line-height:26px;');
}