A simple modal at the center of a page in js
JavaScript CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
modal.js
package.json
style.css

README.md

Modal

Give a simple modal at the middle of a page, okayable and dismissable with a click.

Demo: haroen.me/modal.

Usage

manual way

Link both style.css and modal.js in your html file. Then in a script you can make a new notice by doing

modal(modalText.value, function(){
  // code to evaluate when pressed on okay
}, function(){
  // code to evaluate when pressed on cancel
});

browserify

You need to install this via npm first like this:

npm install --save git+https://github.com/haroenv/modal.git

Just require modal as any other CommonJS module after installing it via npm:

var modal = require('modal');

In terms of CSS you have to decide whether you reference the CSS file, which is in the node_modules folder or use a tool like parcelify to bundle the CSS.

Used by

Haroen Viaene in haroenv/maps-checker.

License

Creative Commons Licence Modal is licensed under a Creative Commons Attribution 4.0 International License. No warranty whatsoever.