Web Development with jQuery (2015)
Part IV. Appendices
Appendix P. Dialog
Dialog Methods |
||
Method |
Description |
Return Value |
dialog(options) |
Makes the selected elements into dialog boxes. |
jQuery |
dialog('close') |
Closes the dialog. |
jQuery |
dialog('destroy') |
Completely removes the dialog. |
jQuery |
dialog('isOpen') |
Determines if the dialog is open. |
Boolean |
dialog('moveToTop') |
Moves the specified dialog on top of the dialogs stack. |
jQuery |
dialog('open') |
Opens the dialog. |
jQuery |
dialog('option',optionName) |
Returns the value of the specified option. |
Mixed |
dialog('option', optionName, value) |
Sets the specified option to the specified value. |
jQuery |
dialog('option') |
Returns an object of options in key, value pairs. |
Object |
dialog('option',optionObject) |
Sets the specified options as an object of key, value pairs. |
jQuery |
dialog('widget') |
Returns a jQuery object containing the dialog. |
jQuery |
Dialog Options |
||
Option |
Description |
Type |
appendTo |
What element the dialog should be appended to. |
Selector |
autoOpen |
When set to true, the dialog opens automatically when the dialog is called. If set to false, it stays hidden until dialog('open') is called on it. |
Boolean |
buttons |
Specifies which buttons should display on the dialog. The property key is the text of the button. The value is the callback function for when the button is clicked. The context of the callback is the dialog element; if you need access to the button, it is available as the target of the event object. |
Object, Array |
closeOnEscape |
Specifies whether the dialog should close when the user presses the [Escape] key. |
Boolean |
closeText |
Specifies the text for the close button. |
String |
dialogClass |
The specified class name(s) will be added to the dialog, for additional styling. |
String |
draggable |
When set to true, the resulting dialog will be draggable. If false, the dialog will not be draggable. |
Boolean |
height |
The height of the dialog, in pixels. |
Number, String |
hide |
Whether and how to animate the closing of a dialog. |
Boolean, Number, String, Object |
maxHeight |
The maximum height to which the dialog can be resized, in pixels. |
Number |
maxWidth |
The maximum width to which the dialog can be resized, in pixels. |
Number |
minHeight |
The minimum height to which the dialog can be resized, in pixels. |
Number |
minWidth |
The minimum width to which the dialog can be resized, in pixels. |
Number |
modal |
When modal is set to true, the dialog will have modal behavior; other items on the page will be disabled (that is, cannot be interacted with). Modal dialogs create an overlay below the dialog but above other page elements. Custom style values for the overlay (for example, changing its color or opacity) can be set by overriding the styles for the ui-widget-overlay class. |
Boolean |
position |
Specifies where the dialog should be displayed. |
Object, String, Array |
resizable |
Specifies whether the dialog will be resizable. |
Boolean |
show |
Whether and how to animate the opening of a dialog. |
Boolean, Number, String, Object |
title |
Specifies the title of the dialog. The title can also be specified by the title attribute on the dialog source element. |
String |
width |
The width of the dialog, in pixels. |
Number |
Dialog Events |
||
Option |
Description |
Value |
beforeClose |
A function that's executed before a dialog is closed. |
function(event, ui) |
close |
A function that's executed when a dialog is closed. |
function(event, ui) |
create |
A function that's executed when a dialog is created. |
function(event, ui) |
drag |
A function that's executed while a dialog is dragged. |
function(event, ui) |
dragStart |
A function that's executed when a dialog is at the beginning of a dialog drag. |
function(event, ui) |
dragStop |
A function that's executed when a dialog drag ends. |
function(event, ui) |
focus |
A function that's executed at the dialog focus event. The function gets passed two arguments in accordance with the triggerHandler interface. The data passed is the focused dialog options object. |
function(event, ui) |
open |
A function that's executed when a dialog is opened. |
function(event, ui) |
resize |
A function that's executed during a dialog resize. |
function(event, ui) |
resizeStart |
A function that's executed when a dialog resize begins. |
function(event, ui) |
resizeStop |
A function that's executed when a dialog resize ends. |
function(event, ui) |
UI Object |
||
Option |
Description |
Type |
ui.position |
The current CSS position of the dialog. |
Object |
ui.offset |
The current offset position of the dialog. |
Object |
ui.originalPosition |
The CSS position of the dialog prior to being resized. |
Object |
ui.originalSize |
The size of the dialog prior to being resized. |
Object |
ui.size |
The current size of the dialog. |
Object |