标题闪烁

pull/30/head
taoshihan1991 4 years ago
parent 911a40c4bd
commit 1365e1af78

@ -183,7 +183,9 @@
this.saveHistory(content);
this.scrollBottom();
flashTitle();//标题闪烁
}
window.parent.postMessage(redata);
},
//发送给客户
chatToUser() {
@ -378,11 +380,19 @@
}
},5000);
},
//初始化
init(){
this.initCss();
this.initConn();
window.onfocus = function () {
clearTimeout(titleTimer);
document.title = originTitle;
};
},
},
created: function () {
this.initCss();
this.initConn();
this.init();
this.getUserInfo();
//加载历史记录
this.getMesssagesByVisitorId();

@ -8,6 +8,7 @@
<meta name="description" content="GO-FLY{{.SubIntro}}" />
<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/layer/3.1.1/layer.min.js"></script>
<script src="/static/js/functions.js"></script>
<style>
*{
margin: 0;padding: 0;
@ -148,5 +149,15 @@ $("#visitorBtn").click(function(){
}
});
});
window.addEventListener('message',function(e){
var msg=e.data;
if(msg.type=="message"){
flashTitle();//标题闪烁
}
});
window.onfocus = function () {
clearTimeout(titleTimer);
document.title = originTitle;
};
</script>
</html>

@ -37,4 +37,19 @@ function notify(title, options, callback) {
callback(notification, event);
}
}
}
var titleTimer,titleNum=0;
var originTitle = document.title;
function flashTitle() {
titleNum++;
if (titleNum == 3) {
titleNum = 1;
}
if (titleNum == 1) {
document.title = '【】' + originTitle;
}
if (titleNum == 2) {
document.title = '【你有一条消息】' + originTitle;
}
titleTimer = setTimeout("flashTitle()", 500);
}
Loading…
Cancel
Save