Tiny jQuery Modal / Alert / Toast Plugin - Modal.js

File Size: 6.24 KB
Views Total: 1611
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Tiny jQuery Modal / Alert / Toast Plugin - Modal.js

Modal.js is a lightweight and versatile jQuery plugin which lets you create minimal clean modal windows, alert dialog boxes and toast-style notification messages on your web app.

How to use it:

1. To install the plugin, just place the following JS and CSS files directly in the document.

<link rel="stylesheet" href="modal.css">
<script src="//code.jquery.com/jquery.min.js"></script>
<script src="modal.js"></script>

2. Create a simple alert dialog:

$.alert(text, title)
$.alert(text, callback)
$.alert(text, title, callback)

3. Create a modal window with confirm / cancel buttons:

  text: '',
  title: 'Title',
  className: '',
  btns: ['Okey', 'Cancel'],
  width: 600,
  callback: fn(index)

$.modal.hide() // hide the modal

4. Create a toast like notification popup:

$.toast(text [, stillShow])

This awesome jQuery plugin is developed by shuoshubao. For more Advanced Usages, please check the demo page or visit the official website.