Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/kanety/jquery-simple-dialog


https://github.com/kanety/jquery-simple-dialog

Last synced: 8 days ago
JSON representation

Awesome Lists containing this project

README

        

# jquery-simple-dialog

A jquery plugin for simple dialog.

## Dependencies

* jquery

## Installation

Install from npm:

$ npm install @kanety/jquery-simple-dialog --save

## Usage

Build html as follows:

```html


Dialog Title

content

content




OK
Cancel


Open
```

Then run:

```javascript
$('#content').simpleDialog({
opener: '#open',
closer: '#ok,#cancel'
});
```

### Options

Draggable dialog:

```javascript
$('#content').simpleDialog({
dragger: '#drag'
});
```

Modal dialog:

```javascript
$('#content').simpleDialog({
modal: true
});
```

Focus elements when dialog is opened:

```javascript
$('#content').simpleDialog({
focus: '#ok'
});
```

### Callbacks

Run callbacks when a dialog is opened or closed:

```javascript
$('#content').simpleDialog({
...
}).on('dialog:open', function(e, $handler) {
console.log("opened by " + $handler.attr('id'));
}).on('dialog:close', function(e, $handler) {
console.log("closed by " + $handler.attr('id'));
});
```

## License

The library is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).