【问题标题】:Gritter titles, text, imageGritter 标题、文本、图像
【发布时间】:2016-08-29 00:22:52
【问题描述】:

我有 3 个条件可以呈现 3 个不同的 grinter 通知。条件结果应更改图像、文本和标题。我必须为每个条件都 $.gritt.add({...}) 吗?

或者有没有办法在满足任何条件之前只声明一个 gritter 通知,然后在每个条件中设置可能适用于该条件的标题、文本、图像?

$.gritter.add({...}) 的唯一返回值似乎是一个唯一的 id,它非常适合删除,但乍一看,我看不到添加 gritter 项目的方法在 firebug 中检查 DOM。

感谢任何帮助

【问题讨论】:

    标签: gritter


    【解决方案1】:

    我知道这是几年后的事了,但这就是您更改 grinter 的属性/值的方式:

    var unique_id = $.gritter.add({
        // (string | mandatory) the heading of the notification
        title: '<i class="fa fa-4x fa-bell"></i>&nbsp;&nbsp;New Page Enhancement!',
        // (string | mandatory) the text inside the notification
        text: 'Visit "New Page Enhancements" by clicking on the notifications icon.',
        // (string | optional) the image to display on the left
        image: '../images/logo.png',
        // (bool | optional) if you want it to fade out on its own or just sit there
        sticky: true,
        // (int | optional) the time you want it to be alive for before fading out
        time: '',
        // (string | optional) the class name you want to apply to that specific message
        class_name: 'my-sticky-class'
    });
    

    可以为您计划推出的每个 gritter 实例命名 unique_id。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-09-24
      • 2011-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多