Show:

Q.Dialogs Class

Operates with dialogs.

Item Index

Methods

Methods

pop

(
  • dontTriggerClose
)
HTMLElement static

Closes dialog and removes it from top of internal dialog stack.

Parameters:

  • dontTriggerClose Boolean

    is for internal use only

Returns:

HTMLElement:

The HTML element of the dialog that was just popped.

push

(
  • options
)
HTMLElement static

Shows the dialog and pushes it on top of internal dialog stack.

Parameters:

  • options Object

    A hash of options. For more options see Q/dialog tool.

    • [apply] Boolean optional

      Optional. Set to true if the dialog should show the "apply" style button to close dialog

    • [dialog] Element | JQuery optional

      If provided, may be Element or jQuery object containing already prepared dialog html structure with 'Q_title_slot', 'Q_dialog_slot' and appropriate content in them. If the 'title', 'content' or 'template' options are provided, they will be used to replace the content in this element.

    • [url] String optional

      Optional. If provided, this url will be used to fetch the "title" and "dialog" slots, to display in the dialog. Thus the default content provided by 'title' and 'content' options given below will be replaced after the response comes back.

    • [title='Dialog'] String | Element optional

      initial dialog title.

    • [content] String | Element optional

      initial dialog content. If the url is not supplied, then this remains the HTML content of the dialog. By default displays an image of a throbber while the url is loading.

    • [template] Object optional

      can be used instead of content option.

      • [name] String optional
        names a template to render into the initial dialog content.
      • [fields] String optional
        fields to pass to the template, if any
      • [text] Array optional
        any text to load for the template
    • [className] String optional

      a CSS class name or space-separated list of classes to append to the dialog element.

    • [htmlClass] String optional

      Any class to add to the html element while the overlay is open

    • [mask] String optional

      Default is true unless fullscreen option is true. If true, adds a mask to cover the screen behind the dialog. If a string, this is passed as the className of the mask.

    • [stylesheet] String | Array optional

      Any stylesheets to load before dialog, to prevent Flash of Unstyled Content. should show the "apply" style button to close dialog

    • [fullscreen] Boolean optional

      Defaults to true only on Android and false on all other platforms. If true, dialog will be shown not as overlay but instead will be prepended to document.body and all other child elements of the body will be hidden. Thus dialog will occupy all window space, but still will behave like regular dialog, i.e. it can be closed by clicking / tapping close icon.

    • [hidePrevious=false] Boolean optional

      Whether to hide the current topmost dialog, and show it again when this newly displayed dialog will be closed

    • [appendTo] HTMLElement, jQuery optional

      Can be DOM element, jQuery object or jQuery selector matching element where dialog should be appended. Moreover, dialog is centered relatively to this element. By default it's document body.

    • [alignByParent=false] Boolean optional

      if true, the dialog will be aligned to the center of not the entire window, but to the center of containing element instead.

    • [noClose=false] Boolean optional

      if true, overlay close button will not appear and overlay won't be closed by pressing 'Esc' key.

    • [closeOnEsc=true] Boolean optional

      indicates whether to close overlay on 'Esc' key press. Has sense only if 'noClose' is false.

    • [removeOnClose] Boolean optional

      Defaults to false if "dialog" is provided, and true otherwise. If true, dialog DOM element will be removed from the document on close.

    • [beforeLoad] Q.Event optional

      Q.Event or function which is called before dialog is loaded.

    • [onActivate] Q.Event optional

      Q.Event or function which is called when dialog is activated (all inner tools, if any, are activated and dialog is fully loaded and shown).

    • [beforeClose] Q.Event optional

      beforeClose Q.Event or function which is called when overlay closing was initiated and it's still visible. Can return false to cancel closing.

    • [onClose] Q.Event optional

      Optional. Q.Event or function which is called when dialog is closed and hidden and probably removed from DOM (if 'removeOnClose' is 'true').

Returns:

HTMLElement:

The HTML element of the dialog that was just pushed.