Skip to content

Haroenv/modal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A simple modal at the center of a page in js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages