2

3 つの異なるグリッター通知をレンダリングする 3 つの条件があります。条件の結果によって、画像、テキスト、およびタイトルが変更されます。単一の条件ごとに $.gritter.add({...}) する必要がありますか?

または、いずれかの条件が満たされる前にグリッター通知を 1 つだけ宣言し、各条件内で、その条件に適用されるタイトル、テキスト、画像を設定する方法はありますか?

$.gritter.add({...}) からの唯一の戻り値は一意の ID であるように見えますが、これは削除に最適ですが、一見したところ、追加されたグリッター項目を調べる方法はわかりませんfirebug の DOM。

どんな助けでも大歓迎です

4

1 に答える 1

0

これは数年後のことですが、グリッターのプロパティ/値を変更する方法は次のとおりです。

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'
});

unique_id は、ロールアウトする予定のグリッターのインスタンスごとに名前を付けることができます。

于 2016-08-28T16:02:45.007 に答える