noty({
layout: 'topRight',
type: 'alert',
text: 'Number of Alerts:'+count,
template: '<div class="noty_message"><span class="noty_text"></span></div>',
closeWith: ['button'],
dismissQueue: true,
animation: {
open: {height: 'toggle'},
close: {height: 'toggle'},
easing: 'swing',
speed: 500
},
timeout: false
});
有没有办法让通知成为可点击的超链接。我考虑了callback onClose()
,但由于我不希望通知关闭,我不能使用它。有回调是onclick
吗?或者我必须以另一种方式做到这一点。比如在文本中添加超链接?
答案 0 :(得分:2)
您可以使用buttons
选项创建一个按钮,在新窗口中打开网址。
noty({
layout: 'topRight',
type: 'alert',
text: 'Number of Alerts:'+count,
template: '<div class="noty_message"><span class="noty_text"></span></div>',
closeWith: ['button'],
dismissQueue: true,
animation: {
open: {height: 'toggle'},
close: {height: 'toggle'},
easing: 'swing',
speed: 500
},
timeout: false,
buttons: [
{
addClass: 'css-class-for-the-btn', text: 'Link', onClick: function ($noty) {
window.open("http://yoururl/");
}
}
]
});
您可以通过在addClass