This is a demonstration and test of the many ways to trigger and determine the content for modals within Opportunity International's front-end framework. The library has jQuery and Weavr as dependencies.
To create a basic modal, you simply
data-modal
attribute to the element that should trigger the modal.
Basic modal
You can also create modals with dynamic content by declaring them with a bit of Javascript.
Dynamic content
If the data-modal
attribute is a URL, the URL will be
loaded in an iframe
in the modal. If the URL is a Vimeo
or YouTube embed URL, it will be displayed in a 16:9 widescreen format.
Otherwise it defaults to a 4:3 format.
iframe modal
Video modal
Modals can be displayed "fullscreen" (i.e. full viewport), making them more like an overlay.
By default, modals are 400px wide. Other sizes can be set
by adding one of Weavr's container classes, such as .contained-12
,
.contained-9
,.contained-6
, etc.
Because modals are sized with classes, you have the freedom to define additional sizes by creating your own classes in your stylesheets.
You can declare callback functions to execute before and after a modal
closes or opens. You can prevent a modal from opening or closing by
returning false
from the beforeOpen()
and
beforeClose()
callbacks, respectively.
Modals can also be opened via Javascript instead of being attached to click event handlers.
Create lightbox-style galleries with OI Lightbox (built on top of OI Modals).
Put the image URL in the href
attribute, and use the rel
attribute to group images into galleries.