Contenu superposé
Needs translation
Purpose
A flexible, responsive overlay plugin. Implements the WAI-ARIA Dialog (Modal) design pattern.
Working example
How to implement
For centred popups, please see the Lightbox documentation.
-
Create a
section
element with a unique id and the following classeswb-overlay modal-content overlay-def
.<section id="unique-id" class="wb-overlay modal-content overlay-def wb-bar-t"></section>
-
Add one of the following classes to the section element to configure the type of overlay:
wb-panel-l
: Left panelwb-panel-r
: Right panelwb-bar-t
: Top barwb-bar-b
: Bottom barwb-popup-mid
: Middle screen overlaywb-popup-full
: Full-screen overlaywb-popup-full hidden-hd
: Full-screen overlay - Hidden header
-
Add the header of the overlay by adding the following code at the start of the section element:
<header class="modal-header"> <h2 class="modal-title">Overlay title</h2> </header>
For the full-screen overlay with a hidden header, use the following instead:
<header> <h2 class="wb-inv">Overlay title</h2> </header>
-
Add the body of the overlay by adding the following code after the header code:
<div class="modal-body"> ... Overlay content ... </idv>
-
Add a way of opening the overlay. The overlay can be opened either by clicking a link or by triggering an event.
-
Link approach: Add the following link to the page where the
href
and thearia-controls
attribute match theid
attribute on thesection
element of the overlay:<li> <a href="#unique-id" aria-controls="unique-id" class="overlay-lnk" role="button">Open overlay</a> </li>
-
Event approach: Trigger the overlay with the following JavaScript code:
$( "#unique-id" ).trigger( "open.wb-overlay" );
-
Configuration options
Option | Description | How to configure | Values |
---|---|---|---|
Overlay type | Configure the type of overlay to display. | Add the configuration class to the <section> element of the overlay. |
|
No print | Hide the opened overlay when printing. | Only work for left panel, right panel, top bar and bottom bar. Add the class no-print to the <section> element of the overlay. |
no-print |
Events
Event | Trigger | What it does |
---|---|---|
wb-init.wb-overlay |
Triggered manually (e.g., $( ".wb-overlay" ).trigger( "wb-init.wb-overlay" ); ). |
Used to manually initialize the Overlay plugin. Note: The Overlay plugin will be initialized automatically unless the required markup is added after the page has already loaded. |
wb-ready.wb-overlay (v4.0.5+) |
Triggered automatically after an overlay is initialized. | Used to identify when an overlay has initialized (target of the event)
|
open.wb-overlay |
Triggered manually (e.g., $( ".wb-overlay" ).trigger( "open.wb-overlay" ); ). |
Used to manually open an overlay (event must be triggered on the section element of the overlay). |
close.wb-overlay |
Triggered manually (e.g., $( ".wb-overlay" ).trigger( "close.wb-overlay" ); ). |
Used to manually close an overlay (event must be triggered on the section element of the overlay). |
wb-ready.wb (v4.0.5+) |
Triggered automatically when WET has finished loading and executing. | Used to identify when all WET plugins and polyfills have finished loading and executing.
|
Source code
- Date de modification :