首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Jquery Gritter通知

Jquery Gritter通知
EN

Stack Overflow用户
提问于 2015-05-01 00:59:29
回答 1查看 2.3K关注 0票数 0

我想用gritter显示一个通知。

当我在表单中插入更新数据时,就会出现gritter通知。我该怎么办?

EN

回答 1

Stack Overflow用户

发布于 2015-08-11 15:28:50

代码语言:javascript
复制
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
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29973657

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档