2012-01-27 78 views
2

我有3個條件會呈現3個不同的gritter通知。條件結果應該改變圖像,文本和標題。我必須爲每個單一條件$ .gritter.add({...})嗎?Gritter titles,text,image

或者有沒有辦法在任何條件滿足之前聲明一個gritter通知,然後在每個條件下設置標題,文本,圖像,因爲它們可能適用於該條件?

看起來$ .gritter.add({...})唯一的返回值是一個唯一的ID,它非常適合移除,但從乍看起來,我沒有看到添加的Gritter檢查螢火蟲中的DOM。

任何幫助表示讚賞

回答

0

我知道這是年後的今天,但你這是怎麼改變屬性gritter的/值:

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可以被命名爲您計劃gritter的每個實例推出。