4-29 15,558 views
Github: https://github.com/needim/noty
new Noty({
text: 'NOTY - a dependency-free notification library!',
animation: {
open: 'animated bounceInRight', // Animate.css class names
close: 'animated bounceOutRight' // Animate.css class names
}
}).show();
全局调用方法
var option = {
'msg' : "it is a error msg",
'type': "error"
};
show_noty(option);
全局函数封装
function show_noty($options = {}){
var options = {
'layout' : typeof $options.layout !== 'undefined' ? $options.layout : 'topRight',
'theme ' : typeof $options.theme !== 'undefined' ? $options.theme : 'mint',
'closeWith': typeof $options.closeWith !== 'undefined' ? $options.closeWith : ['click', 'button'],
'timeout': typeof $options.timeout !== 'undefined' ? $options.timeout : false,
'type': typeof $options.type !== 'undefined' ? $options.type : 'info',
'msg': typeof $options.msg !== 'undefined' ? $options.msg : 'it is a test'
};
new Noty({
text: options.msg,
timeout:options.timeout,
type:options.type,
layout:options.layout,
closeWith:options.closeWith
}).show();
}
写的很好,支持下