【发布时间】:2017-01-29 16:02:39
【问题描述】:
我正在使用最新版本的 Bootstrap Notify (v3.1.5) 在 AJAX 调用后显示状态消息。它在第一次通话中按预期工作。第一次执行后,每次调用 notify 时,都会显示之前的通知消息。
例子:
第一次调用 = 1 条通知消息;第 2 次通话 = 2 条通知消息;第三次调用 = 3 通知消息; ...
引导通知初始化:
$.notify({
icon: icon,
title: title,
message: message
}, {
type: type,
allow_dismiss: true,
newest_on_top: false,
placement: {
from: "top",
align: "right"
},
offset: 20,
spacing: 10,
z_index: 100000,
delay: delay,
timer: 1000,
mouse_over: true,
animate: {
enter: 'animated fadeInDown',
exit: 'animated fadeOutUp'
}
});
我该如何解决这个问题?
【问题讨论】:
-
您从哪里触发此通知?它是在动态创建的 DOM 元素上吗?以及事件是否使数据重新加载
-
解决了我的问题。经过一些调试后,我意识到该事件被多次触发,导致通知反复弹出。真是菜鸟的错误……
标签: javascript jquery ajax twitter-bootstrap bootstrap-notify