Handy Modal Window Library – Modal.js

Category: Javascript , Modal & Popup | May 23, 2019
Author: Guidovv
Views Total: 236
Official Page: Go to website
Last Update: May 23, 2019
License: MIT

Preview:

Handy Modal Window Library – Modal.js

Description:

A pretty simple, and developer-friendly modal window written in pure JavaScript and CSS/CSS3.

The activated modal window can be closed by pressing the ESC key or clicking the X button & background overlay.

How to use it:

Include the minified version of the Modal.js on the page.

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

Create a new modal window and define your own modal content (html is supported as well).

new Modal({
    content: '<h2>test</h2>'
});

By default, the modal window will auto appear on document ready. To open the modal window manually, just set the auto_open to false.

new Modal({
    content: '<h2>test</h2>',
    auto_open: true
});

Decide whether to show the close button or not.

new Modal({
    content: '<h2>test</h2>',
    close_button: true
});

Make the modal window always be centered on the screen. Default: false.

new Modal({
    content: '<h2>test</h2>',
    center: true
});

Add extra CSS class(es) to the modal window. Useful for adding your own styles to the modal window.

new Modal({
    content: '<h2>test</h2>',
    class: 'myClass'
});

You Might Be Interested In:


Leave a Reply