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.
Header
Lorem ipsum dolor sit amet consectetur adipisicing elit. Asperiores dolorum eum in totam amet soluta! Id distinctio
iusto voluptatum ipsam officia, odit neque, fuga, commodi totam repellendus deserunt quod laborum? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Assumenda nostrum doloribus quisquam minima minus animi voluptatum illo
illum. Vel, labore iure aut sed nobis officiis itaque molestias rerum natus vero.
Falling modal
A modal can be opened with a falling effect using the .falling class on the modal
element.
Header
Lorem ipsum dolor sit amet consectetur adipisicing elit. Asperiores dolorum eum in totam amet soluta! Id distinctio
iusto voluptatum ipsam officia, odit neque, fuga, commodi totam repellendus deserunt quod laborum? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Assumenda nostrum doloribus quisquam minima minus animi voluptatum illo
illum. Vel, labore iure aut sed nobis officiis itaque molestias rerum natus vero.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Asperiores dolorum eum in totam amet soluta! Id distinctio
iusto voluptatum ipsam officia, odit neque, fuga, commodi totam repellendus deserunt quod laborum? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Assumenda nostrum doloribus quisquam minima minus animi voluptatum illo
illum. Vel, labore iure aut sed nobis officiis itaque molestias rerum natus vero.
Bouncing modal
A modal can be opened with a bouncing effect using the .bouncing class on the modal
element.
Header
Lorem ipsum dolor sit amet consectetur adipisicing elit. Asperiores dolorum eum in totam amet soluta! Id distinctio
iusto voluptatum ipsam officia, odit neque, fuga, commodi totam repellendus deserunt quod laborum? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Assumenda nostrum doloribus quisquam minima minus animi voluptatum illo
illum. Vel, labore iure aut sed nobis officiis itaque molestias rerum natus vero.
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);