Dialog

Description:
Adding popup windows to your webpage.

Quick navigation Examples

Options

Methods

Events

Options

closable

Type:
Boolean
Default value:
true

Use this option to set the dialog closable or unclosable.
If the dialog is closable it will close in case the user clicks on any other element on the page.

Code examples
Initialize the dialog widget with the closable option specified, using object in constructor
$A.newDialog({
    closable: false
}).draw();                  
            
Initialize the dialog widget with the closable option specified, using method chaining
$A.newDialog().closable(false).draw();
            
Get or set the closable option, after initialization
var dialog = $A.newDialog().draw();
//Setter
dialog.closable(false);  //returns dialog

//Getter
console.log(dialog.closable()); //returns value of closable
            

content

Type:
jQuery
Default value:
$('<div class="automizy-dialog-content">Content</div>')

The content inside the widget can be any jQuery object, AutomizyJS form or HTML code.

Code examples
Initialize the dialog widget with the content option specified, using object in constructor
$A.newDialog({
    content: $('<div class="automizy-dialog-content">Content</div>')
}).draw();                  
            
Initialize the dialog widget with the content option specified, using method chaining
$A.newDialog().content($('<div class="automizy-dialog-content">Content</div>')).draw();
            
Get or set the content option, after initialization
var dialog = $A.newDialog().draw();
//Setter
dialog.content($('<div class="automizy-dialog-content">Content</div>'));  //returns dialog

//Getter
console.log(dialog.content()); //returns the content element
            

hash

Type:
String
Default value:
false

Use this method to set the hash tag in the browser url.

Code examples
Initialize the dialog widget with the hash option specified, using object in constructor
$A.newDialog({
    hash: "newHash"
}).draw();
            
Initialize the dialog widget with the hash option specified, using method chaining
$A.newDialog().draw().hash("newHash");
            

Get or set the hash option, after initialization
var dialog = $A.newDialog().draw();
//Setter
dialog.hash("newHash");  //returns dialog

//Getter
console.log(dialog.hash()); //returns value of hash
            

minHeight

Type:
String
Default value:
'0px'

Use this method to set the minimum height of the dialog box.

Code examples
Initialize the dialog widget with the minHeight option specified, using object in constructor
$A.newDialog({
    minHeight: "200px"
}).draw();
            
Initialize the dialog widget with the minHeight option specified, using method chaining
$A.newDialog().draw().minHeight("200px");
            

Get or set the minHeight option, after initialization
var dialog = $A.newDialog().draw();
//Setter
dialog.minHeight("200px");  //returns dialog

//Getter
console.log(dialog.minHeight()); //returns value of minHeight
            

position

Type:
String
Default value:
'center middle'

Use this function to set the position if the dialog widget.
First word of string: Horizontal position. Accepted values: left | center | right
Second word of string: Vertical position. Accepted values: top | middle | bottom

Code examples
Initialize the dialog widget with the position option specified, using object in constructor
var dialog = $A.newDialog({position: 'left bottom'}).draw();
            
Initialize the dialog widget with the position option specified, using method chaining
var dialog = $A.newDialog().position('left bottom').draw();
            

Get or set the position option, after initialization
var dialog = $A.newDialog().draw();
//Setter
dialog.position('left bottom'); //returns dialog

//Getter
console.log(dialog.position());  //returns value of position
            

positionX

Type:
String
Default value:
'center'

positionX determines the distance between the left edge of the dialog widget and the left edge of its containing element in pixels.

Code examples
Initialize the dialog widget with the positionX option specified, using object in constructor
$A.newDialog({
    positionX: '100px'
}).draw();                  
            
Initialize the dialog widget with the positionX option specified, using method chaining
$A.newDialog().positionX('100px').draw();
            
Get or set the positionX option, after initialization
var dialog = $A.newDialog().draw();
//Setter
dialog.positionX('100px');  //returns dialog

//Getter
console.log(dialog.positionX()); //returns value of positionX
            

positionY

Type:
String
Default value:
'middle'

positionY determines the distance between the top edge of the dialog widget and the top edge of its containing element in pixels.

Code examples
Initialize the dialog widget with the positionY option specified, using object in constructor
$A.newDialog({
    positionY: '100px'
}).draw();                  
            
Initialize the dialog widget with the positionY option specified, using method chaining
$A.newDialog().positionY('100px').draw();
            
Get or set the positionY option, after initialization
var dialog = $A.newDialog().draw();
//Setter
dialog.positionY('100px'); //returns dialog

//Getter
console.log(dialog.positionY()); //returns value of positionY
            

title

Type:
String
Default value:
My Dialog

The displayed title in the dialog widget.

Code examples
Initialize the dialog widget with the title option specified, using object in constructor
$A.newDialog({
    title: 'MyDialog'
}).draw();                  
            
Initialize the dialog widget with the id option specified, using method chaining
$A.newDialog().title('MyDialog').draw();
            
Get or set the title option, after initialization
var dialog = $A.newDialog().draw();
//Setter
dialog.title('MyDialog'); //returns dialog

//Getter
console.log(dialog.title()); //returns value of title
            

width

Type:
Number | String
Default value:
'60%'

The width of the dialog widget.

Code examples
Initialize the dialog widget with the width option specified, using object in constructor
$A.newDialog({
    width: 600
}).draw();                  
            
Initialize the dialog widget with the width option specified, using method chaining
$A.newDialog().width(600).draw();
            
Get or set the width option, after initialization
var dialog = $A.newDialog().draw();
//Setter
dialog.width(600);  //returns dialog

//Getter
console.log(dialog.width()); //returns value of width
            

zIndex

Type:
Number
Default value:
3000

The zIndex property specifies the stack order of an element.
An element with greater stack order is always in front of an element with a lower stack order.

Code examples
Initialize the dialog widget with the zIndex option specified, using object in constructor
$A.newDialog({
    zIndex: 3000
}).draw();                  
            
Initialize the dialog widget with the zIndex option specified, using method chaining
$A.newDialog().zIndex(3000).draw();
            
Get or set the zIndex option, after initialization
var dialog = $A.newDialog().draw();
//Setter
dialog.zIndex(3000);  //returns dialog

//Getter
console.log(dialog.zIndex()); //returns value of zIndex
            

Methods

close

Returns:
Dialog

Invoke this function to close the current dialog.

Code examples
var dialog = $A.newDialog().draw();
dialog.open();
setTimeout(function(){
    dialog.close();
    },1000);
            

open

Returns:
Dialog

Invoke this function to open the current dialog.

Code examples
var dialog = $A.newDialog().draw();
dialog.open();
setTimeout(function(){
    dialog.close();
    },1000);
            

setMaxHeight

Returns:

This is a helper function which adjusts the dialog window's max height to the browser.
If the dialog would be hang out of the browser window this function will make it just the right size and add a scrollbar to it.

Code examples
var dialog = $A.newDialog({
    content: $('<div class="automizy-dialog-content">Text<br>Text<br>Text<br>Text<br>Text<br>Text<br>Text<br>Text<br>Text<br>Text<br>Text<br>Text<br></div>')
}).draw();
            

Events

Examples

A simple module


            

Demo: