我有3个条件,可以渲染3个不同的gritter通知。条件结果应更改图像、文本和标题。我必须为每个条件执行$.gritter.add({...})吗?
或者,有没有一种方法可以在满足任何条件之前只声明一个gritter通知,然后在每个条件中设置标题、文本、图像,因为它们可能适用于该条件?
似乎从$.gritter.add({...})返回的唯一值是一个唯一的id,这对于删除非常有用,但乍一看,我并没有看到通过检查firebug中的DOM来添加gritter项的方法。
任何帮助我们都将不胜感激
发布于 2016-08-29 00:02:45
我知道这是几年后的事了,但这就是如何更改gritter的属性/值:
var unique_id = $.gritter.add({
// (string | mandatory) the heading of the notification
title: '<i class="fa fa-4x fa-bell"></i> 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'
});可以根据您计划推出的每个gritter实例来命名unique_id。
https://stackoverflow.com/questions/9027999
复制相似问题