0

gritter jqueryでお知らせを表示したい。

グリッター通知が表示されるフォームで挿入更新データを作成すると。私は何をすべきか?

4

1 に答える 1

0
I have added extra parameter by customizing gritter.js
I have added **notificationID** in popup for my notification popup to close popup dynamically even from database.

**Here is my code**:-
in jquery.gritter.js file.
adding the parameter in gritter option
        position: '',
        class_name: '', // could be set to 'gritter-light' to use white notifications
        fade_in_speed: 'medium', // how fast notifications fade in
        fade_out_speed: 1000, // how fast the notices fade out
        time: 6000, // hang on the screen for...
        **notificationID: ''**
    }

// Public - options to over-ride with $.gritter.options in "add"
        position: '',
        fade_in_speed: '',
        fade_out_speed: '',
        time: '',
        **notificationID: '',**


// adding the dynamic id in dataId....
_tpl_close: '<a class="gritter-close" data-id="[[notificationID]]" href="#" tabindex="1">Close Notification</a>',

//Put in Basics
notificationID = params.notificationID || '';

//define in temp
tmp = this._str_replace(
                ['[[title]]', '[[text]]', '[[close]]', '[[image]]', '[[number]]', '[[class_name]]', '[[item_class]]', '[[notificationID]]'],
                [title, text, this._tpl_close, image_str, this._item_count, class_name, item_class, notificationID], tmp
            );


In your js file like mine was notification.js

$.gritter.add({
                    title: val.title,
                    text: val.message,
                    notificationID: val.notification_id,
                    sticky: false,
                    time: '10000'
                });


Very simple.Try It
于 2015-08-11T07:28:49.890 に答える