0.8.13 • Published 2 years ago

@pluginjs/modal v0.8.13

Weekly downloads
1
License
GPL-3.0
Repository
github
Last release
2 years ago

Modal

npm package

A flexible modern modal js plugin.

Samples

Introduction

Installation

Yarn

yarn add @pluginjs/modal

NPM

npm i @pluginjs/modal

Getting Started

CDN:

Development:

<script src="https://unpkg.com/@pluginjs/modal/dist/modal.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@pluginjs/modal/dist/modal.css">

Production:

<script src="https://unpkg.com/@pluginjs/modal/dist/modal.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@pluginjs/modal/dist/modal.min.css">

Initialize

HTML:

<div class="element"></div>

ECMAScript Module:

import Modal from "@pluginjs/modal"
import "@pluginjs/modal/dist/modal.css"

Modal.of(document.querySelector('.element'), options)

CommonJS:

require("@pluginjs/modal/dist/modal.css")
const Modal = require("@pluginjs/modal")

Modal.of(document.querySelector('.element'), options)

Browser:

<link rel="stylesheet" href="https://unpkg.com/@pluginjs/modal/dist/modal.css">
<script src="https://unpkg.com/@pluginjs/modal/dist/modal.js"></script>
<script>
  Pj.modal('.element', options)
</script>

API

Options

Options are called on modal instances through the modal options itself. You can also save the instances to variable for further use.

NameDescriptionDefault
"theme"Add plugin theme optionnull
"template"The main element templatesfunction() {...}
"templates"Element templates{}
"autoDestroy"Remove the element when closed, true or falsetrue
"title"Whether to display title, true or false
"content"Whether to display content, true or false
"html"Whether the content is html, true or falsetrue
"close"Whether to display close button, true or falsetrue
"locale"Multilingual settingsen
"localeFallbacks"Multilingual settingstrue
"buttons"Whether to display buttonnull
"overlay"Whether to display overlay, true or falsetrue
"overlayCloseOnClick"Click the background to turn off the modal, true or falsetrue
"appendTo"where modal will be insertedbody
"effect"Open and close the animationfadeScale
"contentAlignment"content alignment, left, center or rightleft
"buttonAlignment"button alignment, left, center or rightright
"titleAlignment"title alignment, left or centerleft
"defaultButtonClass"Default button stylepj-btn pj-btn-primary
"icon"Whether to display icon, If you need to fill in success, info or error
"icons"Default button style description{"success":["icon-check-circle","#4be1ab"],"info":["icon-exclamation-circle","#4c93d9"],"error":["icon-times-circle","#f86b67"]}
"iconColor"Modify the icon color
"iconClass"Add your icon

Events

Events are called on modal instances through the modal events itself. You can also save the instances to variable for further use.

NameDescription
"open"Gets fired when plugin is destroy
"close"Gets fired when plugin is close
"destroy"Gets fired when plugin is destroy
"show"Gets fired when plugin is show
"hide"Gets fired when plugin is hide

Methods

Methods are called on modal instances through the modal method itself. You can also save the instances to variable for further use.

NameDescription
"destroy"Destroy plugin

Classes

Name | Description | Default --|| "NAMESPACE" | Declare plugin namespace | pj-modal "ELEMENT" | Declare plugin | {namespace} "THEME" | Declare plugin theme | {namespace}-{theme} "CLOSE" | Declare element is close | {namespace}-close "CONTENT" | Declare element is body | {namespace}-body "TITLE" | Declare element is title | {namespace}-title "ACTIVE" | Declare plugin is actived | {namespace}-active "DISABLED" | Declare plugin is disabled | {namespace}-disabled "CONTAINER" | Declare plugin range | {namespace}-container "HEADER" | Declare element is header | {namespace}-header "BUTTONS" | Declare element is buttons | {namespace}-buttons "OVERLAY" | Declare element is overlay | {namespace}-overlay "FADEIN" | Declare the style of the element fadeIn | {namespace}--fadeIn "OPEN" | Declare element is open | {namespace}-open "IN" | Declare element is in | {namespace}-in "BUTTON" | Declare element is button | {namespace}-btn "ICON" | Declare element is icon | {namespace}-icon

Translations

Name | EN | ZH --||- "Cancel" | Cancel | 取消 "Yes" | Yes | 确定

Browser support

Tested on all major browsers.

IE / EdgeFirefoxChromeSafariOpera
IE11, Edgelast 2 versionslast 2 versionslast 2 versionslast 2 versions

License

@pluginjs/modal is Licensed under the GPL-v3 license.

If you want to use @pluginjs/modal project to develop commercial sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary.

For purchase an Commercial License, contact us purchase@thecreation.co.

Copyright

Copyright (C) 2022 Creation Studio Limited.

0.8.13

2 years ago

0.8.12

2 years ago

0.8.11

3 years ago

0.8.10

3 years ago

0.8.9

3 years ago

0.8.8

3 years ago

0.8.7

3 years ago

0.8.6

4 years ago

0.8.5

4 years ago

0.8.4

4 years ago

0.8.3

4 years ago

0.8.2

4 years ago

0.7.23

4 years ago

0.7.22

4 years ago

0.7.21

4 years ago

0.7.20

5 years ago

0.7.19

5 years ago

0.7.18

5 years ago

0.7.17

5 years ago

0.7.16

5 years ago

0.7.15

5 years ago

0.7.14

5 years ago

0.7.13

5 years ago

0.7.12

5 years ago

0.7.11

5 years ago

0.7.10

5 years ago

0.7.9

5 years ago

0.7.8

5 years ago

0.7.7

5 years ago

0.7.6

5 years ago

0.7.5

5 years ago

0.7.4

5 years ago

0.7.3

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.5

6 years ago

0.6.4

6 years ago

0.6.3

6 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.2.18

6 years ago

0.2.17

6 years ago

0.2.16

6 years ago

0.2.15

6 years ago

0.2.14

6 years ago

0.2.13

6 years ago

0.2.12

6 years ago

0.2.10

6 years ago

0.2.9

6 years ago

0.2.8

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago