user3328513
user3328513

Reputation: 199

making a noty notification a clickable hyperlink

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
});

Is there any way of making the notification a clickable hyperlink. I have considered the callback onClose() but as I don't want the notification to close I can't use this. Is there a callback which is onclick? or will I have to do it another way. like putting a hyperlink into the text?

Upvotes: 0

Views: 564

Answers (1)

d.yuk
d.yuk

Reputation: 809

You could make use of the buttons option to create a button which would open a URL in a new window.

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/");
            }
        }
    ]
});

And you could customize the CSS for the button by defining the class in addClass

Upvotes: 3

Related Questions