【发布时间】:2014-07-01 02:31:16
【问题描述】:
我正在使用 noty.js 插件 (http://ned.im/noty/) 向用户显示状态信息。如果用户在显示时单击 noty.js 消息,该消息将被隐藏。
如何禁用点击隐藏功能?我只想让消息一直显示,直到我自动隐藏它或我的程序命令隐藏它。
谢谢。
【问题讨论】:
我正在使用 noty.js 插件 (http://ned.im/noty/) 向用户显示状态信息。如果用户在显示时单击 noty.js 消息,该消息将被隐藏。
如何禁用点击隐藏功能?我只想让消息一直显示,直到我自动隐藏它或我的程序命令隐藏它。
谢谢。
【问题讨论】:
来自文档,以下是默认值:
$.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: []
});
然后点击它就不会关闭了。
【讨论】:
noty({text:'Data Saved', layout: 'topRight', type: 'success',killer : true,timeout: 1000});
【讨论】: