6

我正在使用 noty.js 插件(http://ned.im/noty/)向用户显示状态信息。如果用户在显示时单击 noty.js 消息,该消息将被隐藏。

如何禁用点击隐藏功能?我只想让消息一直显示,直到我自动隐藏它或我的程序命令隐藏它。

谢谢你。

4

2 回答 2

6

从文档中,这是默认值:

$.noty.defaults = {
    layout: 'top',
    theme: 'defaultTheme',
    type: 'alert',
    text: '', // can be html or string
    dismissQueue: true, // If you want to use queue feature set this true
    template: '<div class="noty_message"><span class="noty_text"></span><div class="noty_close"></div></div>',
    animation: {
        open: {height: 'toggle'},
        close: {height: 'toggle'},
        easing: 'swing',
        speed: 500 // opening & closing animation speed
    },
    timeout: false, // delay for closing event. Set false for sticky notifications
    force: false, // adds notification to the beginning of queue when set to true
    modal: false,
    maxVisible: 5, // you can set max visible notification for dismissQueue true option,
    killer: false, // for close all notifications before show
    closeWith: ['click'], // ['click', 'button', 'hover']
    callback: {
        onShow: function() {},
        afterShow: function() {},
        onClose: function() {},
        afterClose: function() {}
    },
    buttons: false // an array of buttons
};

注意这个属性:

closeWith: ['click'], // ['click', 'button', 'hover']

如果你打电话:

noty({
  ...
  closeWith: []
});

然后当你点击它时它不会关闭。

于 2014-07-01T02:40:33.763 回答
0
noty({text:'Data Saved', layout: 'topRight', type: 'success',killer : true,timeout: 1000});
于 2020-07-03T01:01:33.000 回答