# Notification \ **Popup notifications** is a lightweight Javascript library for popup messages on a web page. Pure javascript and css, any dependencies. You can use it as toast messages or a single notification. ## Live Demo [Click here](https://amaterasusan.github.io/notification/) ## Getting Started ### Just include files in the HTML: ``\ `` ### Or use it as an ES module in your project: ```javascript import Notification from 'path/to/notification-es.js'; ``` ## options All options are optional * **position**\ top-right (default value)\ bottom-right\ top-left\ bottom-left\ center * **duration**\ default 5000\ time in milliseconds the notification will be displayed\ if duration is 0 - popup notification will be displayed all the time * **isHidePrev**\ default false\ hide previous popup(s) or not * **isHideTitle**\ default false\ hide title block or not\ if it is set to true and the duration is 0,\ an X close button will appear on the right side of the notification body to allow the popup to close. * **maxOpened**\ default 5, the maximum value can be set to 10 ## Usage ``` const popup = Notification({ position: 'top-left', duration: 4000, isHidePrev: false, isHideTitle: false, maxOpened: 3, }); // or const popup = Notification(); // options will be set by default // then later you can set any options like popup.setProperty({ duration: 5000, isHidePrev: true, }); ``` ### the following popup methods are available: * error * warning * info * success * dialog * setProperty * hide ``` // error popup.error({ title: 'Oops', message: `An error has occurred"`, }); // or even insert HTML popup.error({ title: `