2012-01-27 9 views
2

私は3つの違う苦味の通知を与える3つの条件があります。条件結果は、画像、テキスト、およびタイトルを変更する必要があります。すべての単一の条件に対して$ .gritter.add({...})する必要がありますか?タイトル、テキスト、イメージ

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

$ .gritter.add({...})の唯一の戻り値は一意のIDですが、削除には最適ですが、一見すると、追加されたグリッターには向かないアイテムは火かき棒でDOMを検査しています。

すべてのヘルプは

答えて

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は、あなたが計画してグリッターのインスタンスごとに名前を付けることができますロールアウトします。

関連する問題