JAVASCRIPT
Modal dialog prompts
All samples are using Ink.requireModules
, please read how to use it at Ink.requireModules section
Method name | Description |
---|---|
new Modal(selector, [options]) | Constructor |
.destroy() | Removes the modal from the DOM |
.dismiss() | Closes the modal. |
.getContentElement() | Returns the content DOM element |
.getModalElement() | Returns the modal element |
.getShadeElement() | Returns the modal shade (the page-covering dark shade element) |
.isOpen() | Returns whether the modal is currently open. |
.open([event]) | Opens this Modal. |
.setContentMarkup(contentMarkup) | Replaces the content markup |
selector
Element or IDoptions
Options object, containing:options.width
Default/Initial width. Ex: '600px'options.height
Default/Initial height. Ex: '400px'options.shadeClass
Custom class to be added to the div.ink-shadeoptions.modalClass
Custom class to be added to the div.ink-modaloptions.trigger
CSS Selector for target elements that will trigger the Modal.options.autoDisplay
Displays the Modal automatically when constructed.options.markup
Markup to be placed in the Modal when createdoptions.onShow
Callback function to run when the Modal is opened.options.onDismiss
Callback function to run when the Modal is closed. Return `false` to cancel dismissing the Modal.options.closeOnClick
Flag to close the modal when clicking outside of it.options.closeOnEscape
Determines if the Modal should close when "Esc" key is pressed. Defaults to true.options.responsive
Determines if the Modal should behave responsively (adapt to smaller viewports).options.triggerEvent
(advanced) Trigger's event to be listened. Defaults to 'click'.To view a basic modal window, click the the example modal button. Then check the example code below to know how it's generated.
Code
Removes the modal from the DOM
Closes the modal.
Returns the content DOM element
Returns the modal element
Returns the modal shade (the page-covering dark shade element)
Returns whether the modal is currently open.
Opens this Modal.
Use this if you created the modal with autoDisplay: false
to open the modal when you want to.
event
(internal) In case its fired by the internal trigger.Replaces the content markup
contentMarkup
Markup to be placed inside the modal.