Skip to content

Repository files navigation

TigerLightbox

A tiny, dependency-free lightbox & media viewer. ~5 KB, no jQuery, no build step, no image assets. Images, video, PDFs/iframes and embeds — with gallery navigation, keyboard, touch-swipe, focus-trap, and CSS-variable theming.

Part of the Tiger platform, broken out as a standalone drop-in.

Install

Drop the two files in and reference them — that's it.

<linkrel="stylesheet" href="tiger-lightbox.css"><scriptsrc="tiger-lightbox.js" defer></script>

Or npm install tiger-lightbox.

Use it (attribute API)

Give links a data-tiger-lightbox="<group>" — links sharing a group form one gallery. It auto-wires via a delegated listener, so dynamically added elements work too (grids that re-render, infinite scroll, etc.).

<ahref="photo-1-large.jpg" data-tiger-lightbox="portfolio" data-caption="Sunrise"><imgsrc="photo-1-thumb.jpg" alt="Sunrise"></a><ahref="clip.mp4" data-tiger-lightbox="portfolio" data-type="video" data-caption="Reel"></a><ahref="brochure.pdf" data-tiger-lightbox="portfolio" data-type="pdf"></a>

Attributes:

AttributeMeaning
data-tiger-lightboxgallery group id (items sharing it navigate together)
href / data-srcthe full-size source (data-src wins)
data-typeimage | video | pdf | iframe (auto-detected from the src otherwise)
data-caption / data-titlecaption shown under the media

Use it (JS API)

TigerLightbox.open([{type: 'image',src: 'a-large.jpg',caption: 'A'},{type: 'video',src: 'b.mp4'},{type: 'pdf',src: 'c.pdf',caption: 'Spec sheet'}],0);TigerLightbox.close();

Controls

  • Keyboard:Esc close · / navigate.
  • Touch: swipe left/right to navigate, swipe down to close.
  • Mouse: backdrop or ✕ to close, ‹ / › arrows to navigate.
  • Accessible: role="dialog", aria-modal, focus-trap, focus restored on close.

Theming

Override the --tlb-* custom properties (scope them wherever you like):

:root {
--tlb-bg:rgba(15,17,21,.92); /* backdrop */--tlb-fg:#fff; /* caption/counter */--tlb-ctrl:rgba(255,255,255,.82);
--tlb-ctrl-hover:#fff;
--tlb-radius:8px;
--tlb-max-w:92vw;
--tlb-max-h:82vh;
--tlb-z:2000;
}

License

MIT © WebTigers

About

A tiny, dependency-free lightbox & media viewer (images, video, PDFs, embeds) with gallery nav, keyboard, swipe, and CSS-variable theming.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages