tobento / js-notifier
Simple JavaScript notifier to show notifications.
Installs: 9
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:JavaScript
README
Simple JavaScript notifier to show notifications.
Table of Contents
Getting started
Browser support
Modern browser only.
Documentation
Basic Usage
1. Include CSS/JS
<link href="notifier.css" rel="stylesheet" type="text/css">
2. Import Notifier And Send A Notification
import notifier from "notifier.js"; const notification = notifier.send({ status: 'success', title: 'Lorem', text: 'Lorem ipsum.', });
Parameters
All parameters are optional but you must specify title
or text
at least.
Methods
import notifier from "notifier.js"; const notification = notifier.send({ status: 'success', title: 'Lorem', autotimeout: null, }); // close after 2000 milliseconds: notification.close(2000);
Stacks
By default, notifications will be pushed to the default
stack which will be positioned top right. You may create more stacks by the following way:
1. Create the CSS class
Name your class like .notification-stack-stack-name
:
.notification-stack-secondary { position: fixed; bottom: 1rem; left: 1rem; z-index: 50; width: 400px; }
2. Define the stack within you notifiaction
import notifier from "notifier.js"; const notification = notifier.send({ stack: 'secondary', title: 'Lorem', });