├── .github
└── FUNDING.yml
├── CHANGELOG.md
├── LICENSE.md
├── README.md
├── dist
├── css
│ ├── classic
│ │ ├── confirmation.png
│ │ ├── error.png
│ │ ├── information.png
│ │ ├── prompt.png
│ │ ├── question.png
│ │ ├── spinner.gif
│ │ ├── warning.png
│ │ ├── zebra_dialog.css
│ │ ├── zebra_dialog.min.css
│ │ └── zebra_dialog.scss
│ ├── flat
│ │ ├── confirmation.png
│ │ ├── error.png
│ │ ├── icons.txt
│ │ ├── information.png
│ │ ├── prompt.png
│ │ ├── question.png
│ │ ├── spinner.gif
│ │ ├── warning.png
│ │ ├── zebra_dialog.css
│ │ ├── zebra_dialog.min.css
│ │ └── zebra_dialog.scss
│ └── materialize
│ │ ├── confirmation.png
│ │ ├── error.png
│ │ ├── icons.txt
│ │ ├── information.png
│ │ ├── prompt.png
│ │ ├── question.png
│ │ ├── spinner.gif
│ │ ├── warning.png
│ │ ├── zebra_dialog.css
│ │ ├── zebra_dialog.min.css
│ │ └── zebra_dialog.scss
├── zebra_dialog.min.js
└── zebra_dialog.src.js
└── examples
├── ajax.html
├── coffee_48.png
├── examples.css
├── examples.js
├── favicon.ico
├── flat.html
├── index.html
└── materialize.html
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: stefangabos # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## version 3.1.0 (October 22, 2024)
2 |
3 | - dialog boxes are now draggable by default; see the newly added `draggable` property; see [#38](https://github.com/stefangabos/Zebra_Dialog/issues/38) and thanks [LukeSavefrogs](https://github.com/LukeSavefrogs) for suggesting this A LONG TIME AGO!
4 | - added the `onOpen` event which triggers **after** the dialog box is made visible; see [#39](https://github.com/stefangabos/Zebra_Dialog/issues/39); thanks [LukeSavefrogs](https://github.com/LukeSavefrogs) for suggesting this A LONG TIME AGO!
5 | - added the `onBeforeClose` event which triggers **before** the dialog is hidden; useful for validating input prompts and not closing the dialog box in case the input is not valid
6 | - added `placeholder` property to be used with `prompt` type dialog boxes
7 | - added `prompt_rows` which when set to a value greater than `1` will turn the `input` element in a `prompt` dialog box to a `textarea`
8 | - fixed bug where page scrolling was not disabled when opening modal dialog boxes even though `disable_page_scrolling` was set to `true` by default
9 |
10 | ## version 3.0.7 (May 12, 2024)
11 |
12 | - minor maintenance release
13 |
14 | ## version 3.0.6 (April 22, 2024)
15 |
16 | - minor maintenance release
17 |
18 | ## version 3.0.5 (August 18, 2020)
19 |
20 | - fixed bugs when working with iFrames
21 |
22 | ## version 3.0.4 (August 17, 2020)
23 |
24 | - fixed bug where the `disable_page_scrolling` property introduced in `3.0.0` had an undesired effect on pages where there was no scroll
25 |
26 | ## version 3.0.3 (July 19, 2020)
27 |
28 | - SASS files are now available in the `dist` folder
29 | - fixed broken example for overlapping dialogs
30 |
31 | ## version 3.0.2 (April 26, 2020)
32 |
33 | - minor release which only adds screenshots to the examples
34 |
35 | ## version 3.0.1 (March 31, 2020)
36 |
37 | - fixed [#32](https://github.com/stefangabos/Zebra_Dialog/issues/32) where the `center_buttons` property was not centering buttons; thanks [LukeSavefrogs](https://github.com/LukeSavefrogs)!
38 |
39 | ## version 3.0.0 (September 03, 2019)
40 |
41 | - page scrolling behind an open dialog box is now disabled by default
42 | - added `margin` property to prevent the dialog box from touching the viewport's limits when stretched 100% horizontally and/or vertically
43 | - added `max_width` property which, together with the existing `max_height` property, can now be specified as percentage
44 | - added the `default_value` property to be used for `prompt` type dialog boxes
45 | - `width` and `height` properties can now be specified as percentages, too
46 | - `custom_class` is now also added to the overlay, not just to the dialog box
47 | - the word `center` can also be used when specifying vertical position (alongside `middle`)
48 | - when using iFrames, the width and height is now automatically computed to fit those of the dialog box; additionally, now a spinner is also shown while the iFrame content is loading
49 | - the library now automatically does backdrop management when opening multiple modal dialog boxes
50 | - dropped IE6 support
51 | - fixed bug where the positioning of the dialog box was incorrect it had borders
52 | - removed the `backdrop_container` property
53 | - minor tweaks to all the templates
54 |
55 | ## version 2.1.0 (June 03, 2019)
56 |
57 | - added [prompt](https://stefangabos.github.io/Zebra_Dialog/flat.html#handling-input) dialog box type; thanks to [Sebi Popa](https://github.com/sebipopa)!
58 | - added `height` property for setting custom heights to dialog boxes
59 | - added `update` method for adjusting the dialog box's position when content is changed dynamically, at run-time
60 | - the overlay can now have a different parent than the `body` element, via the newly added `overlay_container` property
61 |
62 | ## version 2.0.0 (August 01, 2018)
63 |
64 | - added a new "auto_focus_button" property for indicating the button to place the focus on when a dialog box is first shown
65 | - simplified dialogs' HTML markup and all the classes indicating various states/setups of the dialog box are now added to the main container
66 | - some of the alignments done previously from JavaScript are now done from CSS - but still working in IE6 :)
67 | - completely rewritten the CSS for the themes and we're now using [clean-css](https://github.com/jakubpawlowicz/clean-css#how-to-use-clean-css-api) to optimize CSS output, resulting in a reduction of 0.5KB for the flat theme and 1.8KB for the classic theme
68 | - added a new *materialize* theme, inspired by Google Material Design
69 |
70 | ## version 1.6.0 (July 10, 2018)
71 |
72 | - "warning" dialog boxes now have "Yes" and "No" buttons instead of just the "Ok" button
73 | - changed the labels for the buttons on "confirmation" dialog boxes from "Yes" and "No" to "Ok" and "Cancel"
74 | - revamped example pages
75 |
76 | ## version 1.5.0 (July 05, 2018)
77 |
78 | - fixed bug where inputs in dialog box could never receive focus on mobile devices - see [#14](https://github.com/stefangabos/Zebra_Dialog/issues/14), thanks [Clément](https://github.com/chou666)!
79 | - fixed [#18](https://github.com/stefangabos/Zebra_Dialog/issues/18) where the plugin was not working in IE8
80 | - custom classes can now be added to buttons; this fixes [#15](https://github.com/stefangabos/Zebra_Dialog/issues/15)
81 | - added version number as a public property - useful to find out the version number even if all you have is the minified source code; see [#13](https://github.com/stefangabos/Zebra_Dialog/issues/13)
82 |
83 | ## version 1.4.1 (October 13, 2017)
84 |
85 | - fixed bug where dialog box height could exceed viewport height; see [#8](https://github.com/stefangabos/Zebra_Dialog/issues/8)
86 | - fixed scrolling on iPhone; see [#9](https://github.com/stefangabos/Zebra_Dialog/issues/9)
87 |
88 | ## version 1.4.0 (June 04, 2017)
89 |
90 | - performance improvements and source code tweaks
91 | - new folder structure
92 | - the home of the library is now exclusively on GitHub
93 | - files required in the build process are not included anymore when installing via npm nor when downloading from GitHub
94 |
95 | ## version 1.3.12 (January 26, 2016)
96 |
97 | - the library is now available as an [npm package](https://www.npmjs.com/package/zebra_dialog)
98 |
99 | ## version 1.3.9 (January 21, 2016)
100 |
101 | - added missing preloader.gif file to the "flat" theme; thanks to **Juan** for reporting;
102 | - replaced all instances of jQuery with $, for consistency and for making it easier to use with jQuery.noConflict(); thanks to **Julio** for suggesting;
103 | - fixes and additions to the bowser.json file, for better integration with [Bower](http://bower.io/)
104 | - examples now use jQuery version 1.12.0
105 | - dropped support for jQuery's deprectated official plugins repository
106 |
107 | ## version 1.3.8 (December 20, 2013)
108 |
109 | - fixed a bug where setting the "type" attribute to FALSE would not remove the left padding of the dialog box; thanks to **Laurent** for reporting
110 | - added "use strict" statement
111 | - added integration with [Grunt](http://gruntjs.com/)
112 | - the library is now available as a [Bower](http://bower.io/) package
113 |
114 | ## version 1.3.7 (November 26, 2013)
115 |
116 | - added a new "flat" theme
117 |
118 | ## version 1.3.6 (October 16, 2013)
119 |
120 | - fixed a bug where custom buttons were showing up in reversed order;
121 | - fixed a bug where, since the previous release, you'd have to explicitly return TRUE from a callback function attached to a custom button, in order for the dialog box to close;
122 | - thanks to **store88** for spotting both of the above!
123 |
124 | ## version 1.3.5 (September 08, 2013)
125 |
126 | - dialog boxes can now be kept open on button click; previously there was no way of keeping a dialog box from closing when a button was clicked; now, returning FALSE from the callback will do just that;
127 |
128 | ## version 1.3.4 (August 18, 2013)
129 |
130 | - added a new "center_buttons" property which when set to TRUE will instruct the script to center any available buttons instead of floating them to the right;
131 | - added a new "show_close_button" property which is set to TRUE by default and which displays the little "x" button in the top-right of the dialog box;
132 | - fixed a few issues in order to keep [JSHint](http://www.jshint.com/) (reasonably) happy;
133 | - slightly increased performance due to optimal management of event handlers;
134 | - fixed an issue where some things that should've been done in CSS were done in JavaScript;
135 |
136 | ## version 1.3.3 (May 29, 2013)
137 |
138 | - The z-index value for the overlay and the dialog box can now be set from CSS. Previously these were set in the JavaScript code and would require hacking the source code in order to change them; thanks **Israel Sato**
139 |
140 | ## version 1.3.2 (May 26, 2013)
141 |
142 | - fixed a bug where if the "reposition_speed" property was > 0 and the browser window was manually resized, the animations for repositioning the window would queue up and slow down the process to almost a complete halt;
143 | - changed the name of the "animation_speed" property to "animation_speed_hide" and added a new "animation_speed_show" used to set the speed by which the dialog box will fade in when appearing;
144 |
145 | ## version 1.3.1 (May 06, 2013)
146 |
147 | - fixed a bug where the dialog box was not looking 100% as expected if the page it was used on had the "box-sizing" CSS property set to "border-box", which is the default for some widely-used CSS frameworks like [Twitter Bootstrap](http://twitter.github.io/bootstrap/) and [Foundation](http://foundation.zurb.com/). Read more about it at [http://paulirish.com/2012/box-sizing-border-box-ftw/](http://paulirish.com/2012/box-sizing-border-box-ftw/)
148 |
149 | ## version 1.3 (April 08, 2013)
150 |
151 | - external content can now easily be loaded into the dialog box via AJAX, or using an iFrame, or an inline element, by using the newly added "source" property; when passing an inline element, it will be copied together with any attached events - useful for passing, for example, a complete form with attached events; thanks to **tom**;
152 | - the dialog box will use an animation when repositioning due to a browser window resize; the animation's speed is set by the newly added "reposition_speed" property;
153 | - the plugin is now available on [GitHub](https://github.com/stefangabos/Zebra_Dialog)!
154 |
155 | ## version 1.2.2 (February 09, 2013)
156 |
157 | - added a new "max_height" property; when setting it to something to other than "0", the content in the dialog box will be scrolled if it's height exceeds the given value;
158 | - new layout;
159 |
160 | ## version 1.2.1 (January 28, 2013)
161 |
162 | - fixed an issue due to which the plugin was not working with jQuery 1.9.0;
163 |
164 | ## version 1.2 (April 07, 2012)
165 |
166 | - when used as a notification widget, the notification can now be closed before the timer runs out by clicking on it; thanks to **Ovidiu Mihalcea** for suggesting;
167 | - callback functions can now be attached to custom buttons; credit goes to **Matt**!
168 | - added an example on how to add custom icons
169 |
170 | ## version 1.1.1 (September 24, 2011)
171 |
172 | - fixed a bug where the script would sometimes "forget" to clear the semi-transparent overlay; thanks to **Jack Everson** for reporting;
173 |
174 | ## version 1.1 (August 18, 2011)
175 |
176 | - the last button of the dialog box will now have the focus once the dialog box is open. previously, for any dialog boxes other than notifications, if the user pressed the ENTER key, it re-triggered the event and more dialog boxes were shown one on top of the other; thanks to **Yasir** for reporting;
177 | - it is now possible to add a custom class to the dialog box; this makes it easy to switch between styles at run-time; thanks to **Ed** for suggesting;
178 | - fixed a bug where the message's text color was inherited; now it is set from the CSS file;
179 | - examples are now also available in the downloadable package;
180 |
181 | ## version 1.0 (June 25, 2011)
182 |
183 | - initial release
184 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | ### GNU LESSER GENERAL PUBLIC LICENSE
2 |
3 | Version 3, 29 June 2007
4 |
5 | Copyright (C) 2007 Free Software Foundation, Inc.
6 |
2 |
3 | # Zebra Dialog [](https://twitter.com/intent/tweet?text=A+small,+compact,+mobile-friendly+and+highly+configurable+jQuery+plugin+for+creating+responsive+modal+dialog+boxes&url=https://github.com/stefangabos/Zebra_Dialog&via=stefangabos&hashtags=jquery,dialog,notifications,alert,modal,javascript)
4 |
5 | *A small, compact, mobile-friendly and highly configurable jQuery plugin for creating responsive modal dialog boxes*
6 |
7 | [](https://www.npmjs.com/package/zebra_dialog) [](https://www.npmjs.com/package/zebra_dialog) [](https://www.npmjs.com/package/zebra_dialog) [](https://www.jsdelivr.com/package/npm/zebra_dialog) [](https://github.com/stefangabos/Zebra_Dialog/blob/master/LICENSE.md)
8 |
9 | A modal dialog box is a focused interface element that prompts users to take action before returning to the main application. These dialogs are commonly used to capture user attention, deliver important information, confirm actions, or highlight warnings and errors. By temporarily blocking interaction with the rest of the page, modal windows ensure that users address critical tasks or notifications before proceeding, making them a fundamental part of modern web applications.
10 |
11 | **Zebra Dialog** is a small (~12KB minified, 3KB gzipped), compact (one JavaScript file, no dependencies other than jQuery 1.7.0+), mobile-friendly and highly configurable jQuery plugin for creating responsive modal dialog boxes, meant to replace native JavaScript *alert*, *confirm* and *prompt* dialog boxes.
12 |
13 | Can also be used as a notification widget (when configured to show no buttons and to close automatically) for updates or errors, without distracting users from their browser experience by displaying obtrusive alerts.
14 |
15 | [](https://stefangabos.github.io/Zebra_Dialog/flat.html)
16 | [](https://stefangabos.github.io/Zebra_Dialog/materialize.html)
17 | [](https://stefangabos.github.io/Zebra_Dialog/index.html)
18 |
19 | ## Features
20 |
21 | - great looking dialog boxes, out of the box, with 3 beautiful themes included
22 | - 6 types of dialog boxes available: *confirmation*, *error*, *information*, *prompt*, *question* and *warning*
23 | - content can also be added through AJAX calls, iFrames or from inline elements (together with attached events)
24 | - easily customisable appearance by editing the CSS file
25 | - create modal or non-modal dialog boxes
26 | - easily add custom buttons
27 | - position the dialog box wherever you want - not just in the middle of the screen
28 | - dialog boxes are draggable
29 | - callback functions can be used for further customisations
30 | - use callback functions to handle users' choice
31 | - works on mobile devices
32 | - works in pretty much any browser (Chrome, Firefox, Safari, Edge, Opera, Internet Explorer 6+)
33 |
34 | For the [classic theme](https://stefangabos.github.io/Zebra_Dialog/index.html), the icons used for *confirmation*, *information*, *error* and *question* dialog boxes are made by [DryIcon](http://dryicons.com/free-icons/preview/aesthetica/) while the *warning* icon is made by Function Design & Development Studio (website is not online anymore).
35 |
36 | For the [flat theme](https://stefangabos.github.io/Zebra_Dialog/flat.html), the icons used are made by [Elegant Themes](http://www.elegantthemes.com/blog/freebie-of-the-week/beautiful-flat-icons-for-free)
37 |
38 | For the [materialize theme](https://stefangabos.github.io/Zebra_Dialog/materialize.html) theme, the icons used are taken from [Google's Material Design](https://material.io/tools/icons/?style=baseline) *"design language"*.
39 |
40 | ## 🎂 Support the development of this project
41 |
42 | Your support means a lot and it keeps me motivated to keep working on open source projects.
43 | If you like this project please ⭐ it by clicking on the star button at the top of the page.
44 | If you are feeling generous, you can buy me a coffee by donating through PayPal, or you can become a sponsor.
45 | Either way - **Thank you!** 🎉
46 |
47 | [](https://github.com/stefangabos/Zebra_Dialog) [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RKMCMRZB493LY) [
](https://github.com/sponsors/stefangabos)
48 |
49 | ## Demo
50 |
51 | See the [demos](https://stefangabos.github.io/Zebra_Dialog/flat.html)
52 |
53 | ## Requirements
54 |
55 | Zebra Dialog has no dependencies other than jQuery 1.7.0+
56 |
57 | ## Installation
58 |
59 | Zebra Dialog is available as a [npm package](https://www.npmjs.com/package/zebra_dialog). To install it use:
60 |
61 | ```bash
62 | # the "--save" argument adds the plugin as a dependency in packages.json
63 | npm install zebra_dialog --save
64 | ```
65 |
66 | ## How to use
67 |
68 | First, load jQuery from a CDN and provide a fallback to a local source like:
69 |
70 | ```html
71 |
72 |
73 | ```
74 |
75 | Load the Zebra Dialog jQuery plugin:
76 |
77 | ```html
78 |
79 | ```
80 |
81 | Alternatively, you can load Zebra Dialog from [JSDelivr CDN](https://www.jsdelivr.com/package/npm/zebra_dialog) like this:
82 | ```html
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | ```
91 |
92 | Load the style sheet file from a local source
93 |
94 | ```html
95 |
96 | ```
97 |
98 | ...or from [JSDelivr CDN](https://www.jsdelivr.com/)
99 |
100 | ```html
101 |
102 |
105 |
106 |
107 |
110 |
111 |
112 | ```
113 |
114 | Now, within the DOM-ready event do
115 |
116 | ```javascript
117 | $(document).ready(function() {
118 |
119 | // show a dialog box when clicking on an element
120 | $('#element').on('click', function(e) {
121 | e.preventDefault();
122 | new $.Zebra_Dialog('The link was clicked!');
123 | });
124 |
125 | });
126 | ```
127 |
128 | ## Configuration options
129 |
130 | ## Properties
131 |
132 |
Property | 136 |Type | 137 |Default | 138 |Description | 139 |
---|---|---|---|
animation_speed_hide |
144 | integer | 145 |250 | 146 |147 | The speed, in milliseconds, by which the backdrop and the dialog box will be animated when closing. 148 | | 149 |
animation_speed_show |
152 | integer | 153 |0 | 154 |155 | The speed, in milliseconds, by which the backdrop and the dialog box will be animated when appearing. 156 | | 157 |
auto_close |
160 | mixed | 161 |false | 162 |
163 | The number of milliseconds after which to automatically close the dialog box or false to not automatically close the dialog box.
164 | |
165 |
auto_focus_button |
168 | mixed | 169 |true | 170 |
171 | The index (0-based) of the button (from left to right) to place the focus on when a dialog box is first shown. 172 | Set to false to disable.173 | When set to174 | Setting this to true is equivalent to setting it to 0 .175 | Default is TRUE 176 | |
177 |
backdrop_close |
180 | boolean | 181 |true | 182 |183 | Should the dialog box close when the backdrop is clicked? 184 | | 185 |
backdrop_opacity |
188 | double | 189 |.9 | 190 |
191 | The opacity of the backdrop (between 0 and 1 )
192 | |
193 |
buttons |
196 | mixed | 197 |198 | |
199 | Use this for localization and for adding custom buttons. 200 | If set to true , the default buttons will be used, depending on the type of the dialog box: ['Ok', 'Cancel'] for prompt , question and warning types, and ['Ok'] for the other types of dialog boxes.201 | For custom buttons, use an array containing the captions of the buttons to display: ['My button 1', 'My button 2'] .202 | Set to false if you want no buttons.203 | You can also add custom CSS classes, set which button's callback to be triggered when the user presses ENTER while 204 | inside the input box (for prompt dialog boxes and when prompt_rows is 1 ), and/or attach callback functions to individual buttons by using
205 | objects in the form of:206 | [{ 207 | caption: 'My button 1', 208 | custom_class: 'foo', 209 | default_confirmation: true, 210 | callback: function() { // code } 211 | },{ 212 | caption: 'My button 2', 213 | custom_class: 'bar', 214 | callback: function() { // code } 215 | }] 216 | For prompt dialog box types use the default_confirmation property to tell the library
217 | which button's callback to trigger when the user presses ENTER while inside the input box. If
218 | not set, you will have to handle user input via the onBeforeClose event, or you will
219 | not be able to process user input for this case.220 | The above applies only if 221 | Callback functions receive as first argument the entire dialog box, as a jQuery object, and as second argument, 222 | the value entered in the input box - when the dialog box's type is prompt , or undefined
223 | for the other dialog types.224 | A callback function attache to a button is executed as soon as the button is clicked rather than after 225 | the dialog box is closed, as it is the case with the onClose event.226 | A callback function returning FALSE will prevent the dialog box from closing.227 | |
228 |
center_buttons |
231 | boolean | 232 |false | 233 |
234 | Setting this property to true will instruct the plugin to center any available buttons instead of aligning them to the right
235 | |
236 |
custom_class |
239 | mixed | 240 |false | 241 |
242 | An extra class to add to the dialog box's container and to the backdrop (when present). 243 | For example, setting this value to mycustom and in the CSS file having something like244 | .mycustom .ZebraDialog_Title { background: red } 245 | would set the dialog box title's background to red. 246 | Take a look into a theme's style sheet file to see what can be changed.247 | |
248 |
default_value |
251 | string | 252 |"" (empty string) |
253 |
254 | Default value to show in the input box when the dialog box type is prompt .255 | See also the placeholder property.
256 | |
257 |
disable_page_scrolling |
260 | boolean | 261 |true | 262 |
263 | Prevents scrolling of the page behind the dialog box, when the dialog box is open. 264 | This has effect only when the265 | |
266 |
draggable |
269 | mixed | 270 |true for dialog boxes that have a title | 271 |
272 | Whether the dialog box should be draggable or not. 273 | Dialog boxes that have a title are draggable by default unless this property is set to false .274 | For dialog boxes not having a title, set this property to force for making them draggable.
275 | |
276 |
height |
279 | mixed | 280 |0 (automatically set) |
281 |
282 | By default, the height of the dialog box is automatically computed to fit the content (but not exceed viewport). 283 | Can be specified as a numeric value (which will be interpreted as a value in pixels) or as a percentage (of the viewport). 284 | If285 | |
286 |
keyboard |
289 | boolean | 290 |true | 291 |
292 | When set to true , pressing the ESC key will close the dialog box.
293 | |
294 |
margin |
297 | mixed | 298 |0 | 299 |
300 | Margin of the dialog box relative to the viewport's limits (a single value, applied both horizontally and/or vertically) This is used when the dialog box is stretched 100% horizontally and/or vertically and width and max_width are not set (when stretched horizontally) and height and max_height are not set (when stretched vertically).301 | This propery is also taken into account when using the position property.302 | Can be specified as a numeric value (which will be interpreted as a value in pixels) or as a percentage (of the viewport). 303 | |
304 |
max_height |
307 | mixed | 308 |0 | 309 |
310 | The maximum height of the dialog box. 311 | Can be specified as a numeric value (which will be interpreted as a value in pixels) or as a percentage (of the viewport). 312 | If this property is set to valid value greater than313 | |
314 |
max_width |
317 | mixed | 318 |450 | 319 |
320 | The maximum width of the dialog box. 321 | Can be specified as a numeric value (which will be interpreted as a value in pixels) or as a percentage (of the viewport). 322 | If this property is set to valid value greater than323 | |
324 |
message |
327 | string | 328 |329 | |
330 | The text (or HTML) to be displayed in the dialog box. 331 | See the source property on how to add content via AJAX, iFrames or from inline elements.
332 | |
333 |
modal |
336 | boolean | 337 |true | 338 |
339 | When set to true there will be a semitransparent backdrop behind the dialog box, preventing users from clicking the page's content.
340 | |
341 |
placeholder |
344 | string | 345 |"" (empty string) |
346 |
347 | When set to true there will be a semitransparent backdrop behind the dialog box, preventing users from clicking the page's content.348 | See also default_value property.
349 | |
350 |
position |
353 | mixed | 354 |'center' | 355 |
356 | Position of the dialog box. 357 | Can be either center (which would center the dialog box both horizontally and vertically), or an array with 2 elements, in the form of358 | // notice that everything is enclosed in quotes 359 | ['horizontal_position +/- offset', 360 | 'vertical_position +/- offset'] 361 | where 362 |
Positions are relative to the viewport (the area of the browser that is visible to the user) and
368 | the value of the
369 | Examples:370 | // position the dialog box in the top-left corner 371 | // shifted 20 pixels inside 372 | ['left + 20', 'top + 20'] 373 | // position the dialog box in the bottom-right corner 374 | // shifted 20 pixels inside
375 | ['right - 20', 'bottom - 20'] 376 | // position the dialog box in center-top 377 | // shifted 20 pixels down 378 | ['center', 'top + 20'] 379 | Note that when the width of the viewport is less than 768 pixels, any arithmetics will be ignored (so, things like380 | |
381 |
prompt_rows |
384 | integer | 385 |1 | 386 |
387 | If the dialog box type is prompt , setting this property to a value higher than 1
388 | will change the input box to a textarea input having the specified number of rows.
389 | |
390 |
reposition_speed |
393 | integer | 394 |500 | 395 |396 | The duration (in milliseconds) of the animation used to reposition the dialog box when the browser window is resized. 397 | | 398 |
show_close_button |
401 | boolean | 402 |true | 403 |
404 | When set to true , a close button (the little "x") will be shown in the upper right corner of the dialog box.405 | If the dialog box has a title bar then the close button will be shown in the title bar, vertically centered and respecting the right padding. 406 | If the dialog box does not have a title bar then the close button will be shown in the upper right corner of the body of the dialog box, respecting the position related properties set in the stylesheet. 407 | |
408 |
source |
411 | mixed | 412 |false | 413 |
414 | Add content via AJAX, iFrames or from inline elements (together with the already applied events). 415 | This property can be any of the following: 416 |
|
445 |
title |
448 | string | 449 |"" (empty string, no title) |
450 | 451 | Title of the dialog box 452 | | 453 |
type |
456 | mixed | 457 |information | 458 |
459 | Dialog box type. 460 | Can be any of the following: 461 |
type property to false .470 | By default, the warning and question types have two buttons with the captions Ok and Cancel respectively, while the other types have a single button with the caption Ok.
471 | |
472 |
vcenter_short_message |
475 | boolean | 476 |477 | |
478 | Should messages shorter than the dialog's height be vertically centered? 479 | This property is ignored when480 | |
481 |
width |
484 | integer | 485 |0 (uses the value defined in the theme) |
486 |
487 | By default, the width of the dialog box is automatically computed in order to fit the content (but not exceed viewport. 488 | Can be specified as a numeric value (which will be interpreted as a value in pixels) or as a percentage (of the viewport). 489 | If490 | |
491 |
Event | 501 |Description | 502 |
---|---|
onOpen |
507 |
508 | Event fired after the dialog box is opened. 509 | The callback function receives as unique argument the dialog box, as a jQuery element. 510 | |
511 |
onBeforeClose |
514 |
515 | Event fired before the dialog box is closed. 516 | The main difference when compared to the 519 | The callback function receives as first argument the caption of the clicked button or boolean FALSE
520 | if the dialog box is closed by pressing the ESC key, by clicking the dialog box's x
521 | button, or by clicking the backdrop. The argument can also be boolean TRUE when the dialog box
522 | type is prompt and the ENTER key is pressed while inside the input box.523 | As second argument, the callback function receives the value entered in the input box - when the dialog box 524 | type is prompt and a button was clicked or the ENTER key was pressed while inside
525 | the input box, or undefined for any other case.526 | All this is important when expecting user input as you can say that you have user input only 527 | when the value of the first argument is boolean TRUE or the value it's the same as the label of
528 | the button considered as confirmation (i.e. "Ok"), and the value of the second argument is
529 | !== undefined .530 | See the buttons property for another way of handling user input.
531 | |
532 |
onClose |
535 |
536 | Event fired after the dialog box is closed. 537 | For executing functions before the closing of the dialog box, see the onBeforeClose 538 | event or the buttons property. 539 | For properly validating user input you might want to use the onBeforeClose event 540 | or the buttons property! 541 | The callback function receives as first argument the caption of the clicked button or boolean FALSE
542 | if the dialog box is closed by pressing the ESC key, by clicking the dialog box's x
543 | button, or by clicking the backdrop. The argument can also be boolean TRUE when the dialog box
544 | type is prompt and the ENTER key is pressed while inside the input box.545 | As second argument, the callback function receives the value entered in the input box - when the dialog box 546 | type is prompt and a button was clicked or the ENTER key was pressed while inside
547 | the input box, or undefined for any other case.548 | All this is important when expecting user input as you can say that you have user input only 549 | when the value of the first argument is boolean TRUE or the value it's the same as the label of
550 | the button considered as confirmation (i.e. "Ok"), and the value of the second argument is
551 | !== undefined .552 | See the buttons property or the onBeforeClose event for other ways of handling user input.
553 | |
554 |