figlight: a lightbox that keeps your captions
Click a photo and it opens full screen with the caption your page already wrote, credits and licence links included. Arrow keys and swipe move between images, Escape closes. One file, no dependencies, nothing to configure.
Free on a commercial site
Fancybox is excellent, but every live site needs a paid licence, from €29. figlight is MIT: use it anywhere, nothing to buy, no banner to display.
Credits stay clickable
The figcaption is carried into the full-screen view as HTML. When you publish Wikimedia Commons or Unsplash photos, the author name and licence link are a requirement, not decoration.
2.3 KB, one request
Against 43 KB of JS and CSS for Fancybox. No stylesheet to load, no font, no network call of its own. It injects its own styles and gets out of the way.
Put it at the end of the page. Every figure with an image becomes clickable.
<script src="https://cdn.jsdelivr.net/gh/trendbender/[email protected]/dist/figlight.min.js"></script>
Need a different selector, your own caption source or translated button labels? Switch the automatic start off and call it yourself:
<script src="figlight.js" data-figlight="manual"></script>
<script>
figlight.create({
selector: 'article img, .cards img',
caption: (img) => img.dataset.credit || img.alt,
labels: { close: 'Schließen', prev: 'Zurück', next: 'Weiter' }
});
</script>What it handles for you
- Picks the largest image. If the thumbnail carries a srcset, the full-screen view loads the widest candidate instead of blowing up the small one.
- Skips icons. Anything under 400 pixels wide is treated as a logo or a sprite and stays put.
- Leaves links alone. An image wrapped in a link still follows the link.
- Works from the keyboard. Escape closes, arrows move, focus returns to the photo you opened. The overlay is a proper dialog for screen readers.
- Locks the page behind it so the article does not scroll under the open photo.
It was written for our own publishing engine, where every article carries maps and credited photos, and the credit under the photo has to survive into the enlarged view.
What it does not do
figlight is not a full Fancybox replacement. It has no zoom or pinch, no thumbnails, no video, iframes or PDF, and no themes. If you need those on a commercial site without a licence fee, GLightbox and PhotoSwipe are good choices. Pick figlight when the page already has captions and you want one line and nothing else.
| figlight 1.0.1 | Fancybox 6.1.15 | PhotoSwipe 5.4.4 | GLightbox 3.3.1 | baguetteBox 1.13.0 | |
|---|---|---|---|---|---|
| Licence | MIT | Paid for every live site | MIT | MIT | MIT |
| Size | 2.3 KB | 43.2 KB | 23.5 KB | 17.9 KB | 4.6 KB |
| Captions | Reads figcaption, keeps HTML | Yes | Custom code or plugin | title and description, HTML allowed | title or data-caption |
| Zoom | No | Yes | Yes | Yes | Not in its docs |
| Video | No | Yes | Not in its docs | Yes | Not in its docs |
Checked on 6 November 2026 against the Fancybox licence and prices and each project's documentation. Size is the published JS plus CSS from npm, compressed with gzip -9. The old Fancybox 3.5.7 package is GPLv3 and needs jQuery. More detail: Fancybox licence and free alternatives.
Want the whole content engine, not just the viewer?
We build article pipelines that research, write, fact-check and illustrate pages at scale, with maps, credited photos and honest sources. Tell us what you publish.
Get a free 4Queries audit