【问题标题】:making a noty notification a clickable hyperlink使通知通知成为可点击的超链接
【发布时间】:2014-04-08 20:58:17
【问题描述】:
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 的回调?还是我必须以另一种方式来做。喜欢在文本中添加超链接?

【问题讨论】:

    标签: javascript jquery-plugins noty


    【解决方案1】:

    您可以使用buttons 选项来创建一个按钮,该按钮将在新窗口中打开一个 URL。

    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 中定义类来自定义按钮的 CSS

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多