Mobile-friendly Popup Notification Library – minitoast

Category: Javascript , Notification | February 23, 2018
Author: jacojvv-dev
Views Total: 1,322
Official Page: Go to website
Last Update: February 23, 2018
License: MIT

Preview:

Mobile-friendly Popup Notification Library – minitoast

Description:

minitoast is a small, simple, standalone JS library to create toast-like and mobile-friendly popup notifications on the webpage.

How to use it:

Download the minitoast library.

# NPM
$ npm install minitoast --save

Import the minitoast’s JavaScript and CSS files into the document.

<link rel="stylesheet" href="./css/minitoast.css">
<script src="./js/minitoast.js"></script>

Initialize the minitoast library and we’re ready to go.

let instance = new minitoast();

Create toast notifications with different styles.

instance.success('Success message');
instance.warning('Warning message');
instance.error('Error message');
instance.info('Info message');
instance.default('Default message');

Set the timeout in milliseconds.

notif: {
  timeout: 5000
}

Default messages & colors for the popup.

msgs: {
  s: ['', 'Success', 'mt-success'],
  w: ['', 'Warning', 'mt-warning'],
  e: ['', 'Error', 'mt-error'],
  i: ['', 'Info', 'mt-info'],
  d: ['', 'Notification', 'mt-default']
}

You Might Be Interested In:


Leave a Reply