javascript - 使 jQuery Growl 插件消息不会淡出

标签 javascript jquery web growl

我正在使用 jQuery Growl 插件在我的网站上向我的用户通知消息, 我的消息 displayTimeout 是 3500,我的问题是一些通知消息需要在 displayTimeout 之后消失,但有些需要保持静态直到我将它们删除。 我的问题是如何让我的通知保持不变而不消失? 谢谢

最佳答案

这个循环负责显示和淡出..你可以编辑代码..

Growl.prototype.cycle = function() {
    var $growl;
    $growl = this.$growl();
    console.log(this.settings.duration);
    return enter code here$growl.queue(this.present).delay(this.settings.duration).queue(this.dismiss).queue(this.remove);
    };

让它变成这样..

Growl.prototype.cycle = function() {
      var $growl;
      $growl = this.$growl();
      console.log(this.settings.duration);
      if(this.settings.duration==0){
            return $growl.queue(this.present);
      }else{
            return $growl.queue(this.present).delay(this.settings.duration).queue(this.dismiss).queue(this.remove);
      }
    };

所以如果你像这样初始化..

$.growl({
                title: "Saving",
                style: "primary",
                message: 'Please wait...',
                duration: 0
            });

它不会淡出..你可能想使用“dismiss”手动淡出它

关于javascript - 使 jQuery Growl 插件消息不会淡出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12563433/

相关文章:

android - 解码应用程序/八位字节流

php - Web 服务器自主操作?

javascript - 如何选择一个元素中多个子元素的ID?

javascript - 为什么当我编写array.map,foreach或简单的for时,它在Electron + Javascript中异步运行?

php - 如何在wordpress中链接外部CSS?

javascript - 如何制作光滑的轮播全屏?

javascript - 强制 jQuery 显示/隐藏以尊重显示 : table?

javascript - 嵌套函数中的同名变量

javascript - 我怎样才能更有效地针对这种情况进行编程?

javascript - 通过搜索id解析Json