Skip to content
  1. Extras
  2. FetchIt
  3. Modals
  4. Micromodal.js

Micromodal.js

In this section, let's take a few examples with Micromodal.js modals.

Closing a modal

If your form is in a modal window and you would like to close it after a successful form submission, you should use the fetchit:success event to solve the issue.

js
document.addEventListener('fetchit:success', ({ detail }) => {
  const { form } = detail;

  // Define the ID of the window relative to the form

  MicroModal.close('modal-id');
});