1

我只想转到单击我的 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
    }
});

但即使事件自行关闭,也会触发该事件。如何检查用户何时点击通知?

4

1 回答 1

-1

你可以试试这个黑客,它工作正常

           new Noty({
                layout: 'bottomRight',
                text: '<h6 onclick="clickOfDT()">_your text</h6>',
                type: 'warning',
                closeWith: ['button']
            }).show();

            clickOfDT=()=>{
                // HERE YOU GOT THE EVENT
            };
于 2019-09-03T10:40:46.443 回答