MODI 1.1.0

Reference

Properties

template

Template config.

content

Get/set content. Requires content element.

Methods

show String: contents, Boolean: runDefault

Shows the modal.

Dispatches modal:show event.

Inside template, the method definition will be String: contents, Modi: instance.

hide Boolean: runDefault

Hides the modal.

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:

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.