Custom Growl Like Notification Library – simpleNotify

Category: Javascript , Notification | June 22, 2017
Author: drewdulz
Views Total: 613
Official Page: Go to website
Last Update: June 22, 2017
License: MIT

Preview:

Custom Growl Like Notification Library – simpleNotify

Description:

simpleNotify is a simple, lightweight, dependency-free JavaScript library for creating Growl-style notification messages with ease. Currently comes in  4 different types of notifications: Good, Warning, Danger and Attention.

How to use it:

Download and include the simpleNotify’s files on the html page.

<link href="inc/simpleNotifyStyle.css" rel="stylesheet">
<script src="inc/simpleNotify.js"></script>

Create a basic growl notification that will auto dismiss after 7 seconds.

simpleNotify.notify('Hey! This is a Good Notification.', 'good')
// or 
simpleNotify.notify('Hey! This is a Good Notification.')

Change the default notification type.

// warning
simpleNotify.notify('Hey! This is a Warning Notification.', 'warning')

// danger
simpleNotify.notify('Hey! This is a Danger Notification.', 'danger')

// attention
simpleNotify.notify('Hey! This is an Attention Notification.', 'attention')

Override the default variables in the JavaScript.

NOTIFICATION_CLASS_NAME : "simple-notification",
CONTAINER_CLASS_NAME : "simple-notification-container",
CONTAINER_ID_NAME : "notificationContainer",
MARGIN_BETWEEEN_NOTIFICATIONS : 5, //px
NOTIFICATION_WIDTH: 300, //px
NOTIFICATION_TIME : 7000, //ms
notificationCount : 0,