Lightbox for Bricks
A Bricks element that turns the links you choose into a lightbox, built on the native <dialog> element. No gallery markup is required.
Version: 1.0.0 · Requires: Bricks 1.9+, WordPress 6.5+, PHP 8.1+ · See the live demo
Installation
- Upload and activate the plugin. Bricks must be active.
- Add the Lightbox element once to the page or template.
- Enter a Link selector such as
.gallery a. Matching links now open in the lightbox.
What links can open
- Images, and video files (mp4, webm).
- YouTube and Vimeo page links, shown as an embedded player.
- Any URL, when the link has
data-nll-type="iframe". - Inline content, with
href="#id"pointing at an element or a<template>.
Grouping
Tick Group all matching links to treat them as one gallery, or give links data-nll-group="name". Links with data-x-lightbox-link also open, so older markup keeps working.
Settings
- Behaviour: loop, slide, fade or no transition, duration, drag or swipe, arrow keys, click outside closes, return focus, scroll lock, counter, reduced-motion handling.
- Captions: from
data-description, thendata-nll-caption. Optional image alt fallback. Under or over the media, or hidden. - Style: backdrop, control colours, arrow width, icon size, media maximum width. CSS variables:
--nll-backdrop,--nll-ink,--nll-ui-bg,--nll-nav-width,--nll-icon-size,--nll-max-w.
Keyboard and accessibility
Focus moves to the close button on open and returns to the link on close. Esc closes, Left and Right change slide. The dialog is labelled with the caption.
Events and API
nllightbox:open,nllightbox:changeandnllightbox:closefire on the document.NLLightbox.open(linkElement),.close(),.next(),.prev(),.isOpen().
Known limits
- Only links are supported as the source. There is no built-in gallery picker.
- The link list is read when the visitor clicks, so links added later still work.