效果图

没有浏览网页时

回来浏览网页时

JS代码

 var OriginTitile=document.title;
 var st;
 document.addEventListener('visibilitychange',function(){
 if(document.hidden){
 document.title="(つェ⊂)浏览器崩溃了";
 clearTimeout(st);
 console.log('hide');
 }else{
 document.title='(*´∇`*)吖~又好了~ '+OriginTitile;
 console.log('show');
 st=setTimeout(function(){
 document.title=OriginTitile;
 },4000);
 console.log('endChange=');
 }
 });
Last modification:March 18th, 2020 at 11:09 am
如果觉得我的文章对你有用,请随意赞赏