Reference
Properties
template
Template config.
content
Get/set content. Requires content element.
Methods
show String: contents, Boolean: runDefault
Shows the modal.
contents: optional. Contents to show.runDefault: optional. Defines when the default method will be called. By defaultfalse, so the template method has preference when its defined.
Dispatches modal:show event.
Inside template, the method definition will be String: contents, Modi: instance.
hide Boolean: runDefault
Hides the modal.
runDefault: optional. Defines when the default method will be called. By defaultfalse, so the template method has preference when its defined.
Dispatches modal:hide event.
Inside template, the method definition will be Modi: instance.
relocate
Sets small-width and small-height flags, and it’s triggered on window resize.
Dispatches modal:relocate event.
create String: contents
Initialize the modal. Appends elements to the DOM and attaches listeners. Triggered on instantiation.
remove
Removes the elements and the listeners.
element String: name
Returns the specified template element. undefined otherwise.
Events
Dispatched events have the detail property, which contains:
instance: modal’s instance.overlay: overlay element.modal: modal element.
myModal.element('modal').addEventListener('modal:hide', (e) => {
console.log(e.detail.instance);
});
modal:show
Triggered when the modal is shown.
modal:hide
Triggered when the modal hides.
modal:relocate
Triggered on window resize and relocate method call.