By : its_level Published On Wednesday, July 20, 2011, 10:47 In JavaScript
Notification Center is a jQuery plugin that facilitates the process of creating and managing notifications within an application. The primary features of Notification Center are:
*The notification menu in the light theme is based on the work of Orman Clark
Initialize the plugin
var notifications = new $.ttwNotificationCenter();
Initialize notification bubbles
notifications.initMenu({
someCategory:'#menuItemSelector'
});
Create A Notification
//Default parameters
notifications.createNotification('This is a notification');
//Custom parameters.
notifications.createNotification({
message:'This is a notification',
type:'modal',
category:'projects',
icon:'images/some_icon.png',
autoHide:true,
autoHideDelay:3000
});
Use the helpers
notifications.success('This is a success message');
notifications.error('This is an error message');
notifications.warning('This is a warning message');
notifications.notice('This is an info message');
Get notifications from the server
notifications.importNotifications('all', 'unread');
notifications.getNew();
Delete a notification
var notification = notifications.creatNotification('some notification');
notifications.deleteNotifiction(notification);
Get the notifications in a category
var notificationsInSomeCategory = getNotifications('someCategory', 'unread');