使用Pnotify插件http://sciactive.com/pnotify/
我正试图重新定位它到屏幕的左下角,并有它推了连续的菜单..
定位不是问题,但是通知的方向都是一个一个叠加的(我只看到最新的通知,其他的都在后面)
代码应该是直接的,
var stack_bottomleft = {"dir1": "up", "dir2": "up", "push": "top"};
new PNotify({
title: "Title",
type: "Success",
text: "My Message 1",
animation: "fade",
animate_speed: 'fast',
addclass: "stack-bottomleft",
stack: stack_bottomleft
});
new PNotify({
title: "Title",
type: "Success",
text: "My Message 2",
animation: "fade",
animate_speed: 'fast',
addclass: "stack-bottomleft",
stack: stack_bottomleft
});
new PNotify({
title: "Title",
type: "Success",
text: "My Message 3",
animation: "fade",
animate_speed: 'fast',
addclass: "stack-bottomleft",
stack: stack_bottomleft
});
字符串
也许是一个bug?
3条答案
按热度按时间ykejflvf1#
你必须注意你在哪里创建你的堆栈。例如,不要在if语句中创建它,因为它会为每个通知创建一个新的堆栈,堆栈会重新加载。我在pnotify主页上的index.html评论中找到了这个:
字符串
我也有同样的问题:
型
并将其固定为:
型
希望对你有帮助!
t0ybt7op2#
就像mentioned x x @Tristan Reifert一样,在notice init中设置堆栈对象和将堆栈对象传输到notice init参数之间有一个关键的区别。
因此,即使下一个代码也不会工作:
字符串
这里的要点是,同栈通知应该接收为其配置的同一个栈对象。在上面的例子中,新对象将在每次函数调用时初始化,每个通知将接收不同的对象。
为了避免这种情况,所有通知都应针对同一对象。例如:
型
这样,
showNotice()
的每个后续调用都将寻址前面注意到的相同堆栈对象。6yoyoihd3#
在PNotify 5.2.0上
对我来说,只有当状态是PNotify.Stack的示例时,这才有效
字符串