Every front-end developer needs their own modal window. jQuery modal is performant, tested, customisable and easy to integrate. Less than 2.5KB minified and 1KB gzipped.
This isn't a copy and paste plugin, it's just an outline. The plugin is instantiated in the usual manner and an instances API can be accessed via element data.
You can also 'namespace' plugin instances so that multiple modals can be attached to the same parent.
The simplest example is to open a modal window instance with basic HTML content:
The API is flexible enough to do any common task such as confirmation boxes, displaying images and external content.
Global options can be specified via the standard jQuery plugin interface.
fixedpositioning for the modal window instead of
autofor the contents automatic flow width. Default:
max-widthrelative to the modal windows parent. Set to
noneto set no maximum width. Default:
autofor the contents automatic flow height. Default:
max-heightrelative to the modal windows parent. Set to
noneto set no maximum height. Default:
.update()method. Callback A function to call once the window has opened.
.align()method will be called if the window is open.
thiswill refer to the modal instance. Callbacks provided as arguments to the public methods above will be executed in addition to those specified as instance options.