美文网首页
JS实现闪动的title消息提醒效果

JS实现闪动的title消息提醒效果

作者: 无花无酒_3cd3 | 来源:发表于2020-01-21 09:41 被阅读0次

https://www.jb51.net/article/51297.htm

flashTitle() {
      if (this.notificationFlag || window.location.href.indexOf('chars') === -1) {
        if (this.title_flag) {
          this.title_flag = false
          document.title = '【新订单】'
        } else {
          this.title_flag = true
          document.title = '【   】'
        }
      } else {
        document.title = 'title'// 窗口没有消息的时候默认的title内容
        clearInterval(this.flash_title)
      }
    },
    flash_titleIn() {
      clearInterval(this.flash_title)
      this.flash_title = setInterval(() => {
        this.flashTitle()
      }, 2000)
    }

相关文章

网友评论

      本文标题:JS实现闪动的title消息提醒效果

      本文链接:https://www.haomeiwen.com/subject/iqtezctx.html