我只想转到我的noty对象中单击的URL(不是在关闭时,仅当用户单击通知时)。我尝试了这个:
var n = noty({
text: 'Nuevo Comentario: <br>' + data.contenido + ' de ' + data.usuario,
layout: 'bottomRight',
type: 'information',
timeout: 3500,
callback: { onClose: function() { /* Go to the URL i want to go */ }},
animation: {
open: {height: 'toggle'}, // jQuery animate function property object
close: {height: 'toggle'}, // jQuery animate function property object
easing: 'swing', // easing
speed: 500 // opening & closing animation speed
}
});
但是即使事件本身关闭,也会触发该事件。我如何检查用户单击通知的时间?
最佳答案
您可以尝试此技巧,并且效果很好
new Noty({
layout: 'bottomRight',
text: '<h6 onclick="clickOfDT()">_your text</h6>',
type: 'warning',
closeWith: ['button']
}).show();
clickOfDT=()=>{
// HERE YOU GOT THE EVENT
};