【发布时间】:2014-10-09 16:37:02
【问题描述】:
我正在尝试使用 Pnotify 的按钮,但我无法让它们工作。 问题是我将 Pnotify 与 requiredJS 和 Bower 一起使用(在骨干网内)。 我尝试了很多方法..
Pnotify 文档对此问题有评论:(https://github.com/sciactive/pnotify#using-pnotify-with-requirejs) 这是一个例子:
requirejs(['pnotify', 'pnotify.nonblock', 'pnotify.desktop'], function(PNotify){
PNotify.desktop.permission();
new PNotify({
title: 'Desktop Notice',
text: 'If you\'ve given me permission, I\'ll appear as a desktop notification. If you haven\'t, I\'ll still appear as a regular PNotify notice.',
desktop: {
desktop: true
},
nonblock: {
nonblock: true
}
});
});
该示例对我有用,因此我根据需要对其进行了一些修改:
require(['pnotify', 'pnotify.buttons', 'pnotify.nonblock'], function(PNotify){
new PNotify({
title: title ,
text: msg,
type: classes,
delay: delay,
animation: 'fade',
opacity: .9,
nonblock: {
nonblock: true,
nonblock_opacity: .2
}
});
});
这样非阻塞消息可以正常工作吗?桌面通知也可以(如果需要),但是按钮没有出现……有人遇到过类似的问题吗?任何想法?很高兴找到解决方案。谢谢!
注意:我已经安装了所有 pnotify 的模块
【问题讨论】:
标签: javascript backbone.js requirejs pnotify