Modal

Basic modal

Modals are usefull to display content over your page. To create a modal, add the .modal class and an ID.
To trigger it, create a button or element with the .modal-trigger class and a data-target="" pointing on the modal ID, and initialize the modal with JS.
A basic modal comes out from its central position.
Note that you can add a new modal trigger inside a modal to open a new modal over the last one. The new overlay will be placed over the last modal too.

Falling modal

A modal can be opened with a falling effect using the .falling class on the modal element.

Bouncing modal

A modal can be opened with a bouncing effect using the .bouncing class on the modal element.

Javascript initialization

Once HTML was setup, you can activate the modal with this simple code.
Just pass the id of your modal that you want to activate.

To know all the ways to initialize a JS component, please read the JS Init page.

Options

Property Default value Description
overlay true Toggle overlay when modal is active.
animationDuration 400 Opening and closing animation duration in ms.
bodyScrolling false Enable or disable bodyScrolling when the modal is active and over content.

Methods

Method Description
.open() Open modal
.close() Close modal
.overlay(boolean) Enable / disable overlay, works only if overlay option is enabled.
Example : modal.overlay(true);

Events

Event Description
ax.modal.setup Event sent when the modal has been setup.
ax.modal.open Event sent when the open() method is called.
ax.modal.opened Event sent when the modal has been opened.
ax.modal.close Event sent when the close() method is called.
ax.modal.closed Event sent when the modal has been closed.