Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yurayarosh/popup-simple

Small JS plugin to handle popup
https://github.com/yurayarosh/popup-simple

Last synced: 20 days ago
JSON representation

Small JS plugin to handle popup

Awesome Lists containing this project

README

        

# popup-js

### Install

```html
npm i popup-simple
```

```html
open popup

open popup

open popup


```

```js
import Popup from 'popup-simple'

const popup = new Popup()
popup.init()
```

### Options

Standart options
```js
{
preventScroll: true, // add body overflow hidden
escapeHandler: true, // handle Esc button click
closeOnOverlayClick: true, // close on overlay click
toggleBtnClass: false, // type: String, if provided - button '--active' BEM modificator would be toggling.
}
```

### Methods

```js
popup.onOpen = () => {
// some callback
};
popup.onCLose = () => {
// some callback
};
popup.openTarget(target) // open specific popup
popup.closeAll() // close all popups
popup.destroy() // close all popups and remomove listeners
```