初始化一个实例很简单其实,在下面可以看到
// NotyManager initialization
window.NotyManager = new $.NotyManager($('#notifications'), {
bubble : {
top : 10,
left: -2,
showZero: true
},
max: 30,
container: $('#notification-list'),
wrapper: '<div/>',
emptyHTML: '<div class="no-notification">There is no notification in here</div>',
callback: {
onOpen: function() {},
onClose: function() {}
},
useNoty: true,
noty: {
layout: 'bottomLeft',
timeout: false,
closeWith: ['button']
}
});
下面列出了选项和默认值;
// NotyManager initialization
window.NotyManager = new $.NotyManager($('#notifications') /* this is the bubble attach element */, {
// bubble options
bubble : {
top : 10, // default: 10
left: -2, // default: -2
showZero: true // default: false
},
// max bubble count, if the count is bigger than 30 it will show 30+
max: 30, // default: 20
// this this the notification container
container: $('#notification-list'), // default: <div/>
// this is the wrapper of the a single notification
wrapper: '<div/>',
emptyHTML: '<div class="no-notification">There is no notification in here</div>', // default: as is
callback: {
// This callback is fired each time a notification list is opened
onOpen: function() { // default: function(){}
// NotyManager instance accessible with this variable in this scope
console.log('opened', this);
},
// This callback is fired each time a notification list is closed
onClose: function() { // default: function(){}
// NotyManager instance accessible with this variable in this scope
console.log('closed', this);
}
},
// Below settings for the using open source Noty plugin
// if true notifications also appears on the screen
useNoty: true, // default: false
// this settings used when if useNoty is `true`
noty: {
layout: 'bottomLeft', // default: 'bottomLeft'
timeout: false, // default: false
closeWith: ['button'] // default: ['button']
}
});