0.1.0 • Published 1 year ago

@easonlin0716/js-modal v0.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

JS Modal

Easy usage and lightweight vanilla js modal

Demo

https://easonlin0716.github.io/JS-Modal/demo/index.html

Installation

You can install it by npm or simply by CDN

npm

npm install @easonlin0716/js-modal

usage

import modal from "@easonlin0716/js-modal";
import "@easonlin0716/js-modal/dist/js-modal.min.css";

cdn

// put css and js resources in your .html or any template
// css
<link rel="stylesheet" href="https://unpkg.com/@easonlin0716/js-modal/dist/js-modal.min.css" />
// js
<script src="https://unpkg.com/@easonlin0716/js-modal/dist/js-modal.js"></script>

Usage

Open the modal:

modal.open(el, options)

Close the modal:

modal.close()

Options

OptionTypeDefaultDescription
containerClassesarray"mask"Outer container css classes, accept multiple classes.
closeClassstring"close-modal"Closing icon css class.
modalClassstring"modal"Modal content container class. This class will be append to the element passed in modal.open
fadeDurationnumber260Fading duration.
fadeDelaynumber0.6Modal content fade delay.
showClosebooleantrueAllow display close button or not.
escapeClosebooleantrueAllow close by escape button.
clickClosebooleantrueAllow close by clicking background.
allowDragbooleanfalseAllow modal to be dragged.
0.1.0

1 year ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago