var PageTitleNotification = {
    Vars: {
        OriginalTitle: document.title,
        Interval: null,
        IsNotificationEnabled: false
    },
    On: function (notification, intervalSpeed) {
        var _this = this;
        _this.Vars.Interval = setInterval(function () {
            document.title = (_this.Vars.OriginalTitle == document.title)
                                ? notification
                                : _this.Vars.OriginalTitle;
        }, (intervalSpeed) ? intervalSpeed : 1000);
    },
    Off: function () {
        clearInterval(this.Vars.Interval);
        document.title = this.Vars.OriginalTitle;
    }
}
$(window).focus(function () {
     PageTitleNotification.IsNotificationEnabled = false;
     PageTitleNotification.Off();
});

$(window).blur(function () {
     PageTitleNotification.IsNotificationEnabled = true;
});
if (PageTitleNotification.IsNotificationEnabled)
    PageTitleNotification.On("New Chat Message!");

 

相关文章:

  • 2021-12-17
  • 2021-07-14
  • 2022-12-23
  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-30
  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2021-12-18
相关资源
相似解决方案