# jqmodals

> jQuery plugin for modal popups

Latest version **2.1.1** (published 2014-12-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install jqmodals
pnpm add jqmodals
yarn add jqmodals
bun add jqmodals
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2014-12-23 |
| First published | 2014-11-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Kirill Popolov |
| Maintainers | ezhikov |
| Keywords | jquery-plugin, modals, popups |

## Links

- npm: https://www.npmjs.com/package/jqmodals
- Repository: https://github.com/ezhikov/jQmodals
- Issues: https://github.com/ezhikov/jQmodals/issues
- npm.io page: https://npm.io/package/jqmodals

## Dependencies (1)

- [jQuery](https://npm.io/package/jQuery.md) >=2.1.1

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [post-robot](https://npm.io/package/post-robot.md) — 93.7K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads

## Recent versions

- 2.1.1 (latest) — 2014-12-23
- 2.1.0 — 2014-11-25
- 2.0.1 — 2014-11-11

## README

# jQmodals

jQuery plugin for modal popups

v 1.1.0 - ".popup" class now customizable

v 2.0.1 - "closeAll" method, new docs, some bugfixes

v 2.1.0 - wrapper styles automated

v 2.1.1 - css bugfix

* [Usage](#usage)
* [Api](#api)
* [TODO](#todo)


## Usage

Download plugin or install via npm (``npm install jqmodals``)

* Insert your popups into wrapper, like this:

```html
<div class="wrapper">
    <div><!-- content --></div>
    <div><!-- content --></div>
    <div><!-- content --></div>
</div>
```

* Add ``.popup`` class to your popups

* initialize it:

```js
$('.wrapper').jQmodals();
```

* Set your triggers

```js
$('.open').on('mousedown', function(){
    modal.open.('#first');
)}
```

## API

<a name="Modal"></a>
#Modal
##jQuery.fn.jQmodals
jQuery-wrapper for [Modal](#Modal).

**Params**

- \[klass=".popup"\] `string` - Items class

**Example**
modal = $(elem).jQmodals()
modal.open(target)

**Members**

* [Modal](#Modal)
  * [modal.addPopup(popup)](#Modal#addPopup)
  * [modal.open(target, [ajax])](#Modal#open)
  * [modal.close([ajax])](#Modal#close)
  * [modal.closeAll([ajax])](#Modal#closeAll)

<a name="Modal#addPopup"></a>
##modal.addPopup(popup)
Adds popup into list of available popups

**Params**

- popup `jQuery` | `string` | `HTMLElement` - Popup which you intend to add into popups list

**Returns**: [Modal](#Modal)
<a name="Modal#open"></a>
##modal.open(target, [ajax])
Opens popup.

**Params**

- target `jQuery` | `string` | `HTMLElement` - Target popup
- \[ajax\] `function` | `Deferred` | `jqXHR` - jqXHR or Deferred or function. Waits for resolve before close popup.

**Returns**: `jQuery` - Target popup
<a name="Modal#close"></a>
##modal.close([ajax])
Close current popup and (if exists) opens parent popup.

**Params**

- \[ajax\] `function` | `Deferred` | `jqXHR` - jqXHR or Deferred or function. Waits for resolve before close popup.

**Returns**: [Modal](#Modal)
<a name="Modal#closeAll"></a>
##modal.closeAll([ajax])
Close all popups

**Params**

- \[ajax\] `function` | `Deferred` | `jqXHR` - jqXHR or Deferred or function. Waits for resolve before close popup.

**Returns**: [Modal](#Modal)


## Events
###closepopup
Fires after popup closed with current popup as target

``this`` references to targeted popup


##TODO
- [x] ``.popup`` class optionsl
- [x] ``closeAll`` method
- [x] automate main wrapper styles

---
_Source: https://npm.io/package/jqmodals · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
