2

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

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

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

任何帮助表示赞赏

4

1 回答 1

0

我知道这是几年后的事了,但这就是您更改 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。

于 2016-08-28T16:02:45.007 回答