@kanety/jquery-simple-dialog

0.1.2 • Public • Published

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:

<div id="content">
  <div id="drag">Dialog Title</div>
  <div>content</div>
  <div>content</div>
  <hr>
  <div>
    <button type="button" id="ok">OK</button>
    <button type="button" id="cancel">Cancel</button>
  </div>
</div>
<button type="button" id="open">Open</button>

Then run:

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

Options

Draggable dialog:

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

Modal dialog:

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

Focus elements when dialog is opened:

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

Callbacks

Run callbacks when a dialog is opened or closed:

$('#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.

Readme

Keywords

Package Sidebar

Install

npm i @kanety/jquery-simple-dialog

Weekly Downloads

2

Version

0.1.2

License

MIT

Unpacked Size

31.6 kB

Total Files

19

Last publish

Collaborators

  • kanety