Skip to content

MatheusAvellar/LiteLightbox

Repository files navigation

LiteLightbox

A lightweight, plug'n'play lightbox plugin for the web, written in about 200 lines of pure vanilla JavaScript. Minifies to about 3 KB, gzips to a little over 1 KB. Comes with an optional default stylesheet mimicking Wikipedia's lightbox.

Check out the demo/documentation! It's mobile friendly as well :)

What is it?

It's a lightbox plugin for the web – when you click a thumbnail, it'll open a fullscreen modal displaying a higher resolution version of it, like this:

Main pageLightbox open
2022-11-05_16-26-50 2022-11-05_16-26-59

Why did you make another lightbox library? Didn't you know we have like thousands of those?

I needed a small and lightweight lightbox that mimicked Wikipedia's to use in a personal project of mine. I figured it'd be easier to write my own than to figure out what's the best alternative out there that was customizable enough for my needs.

Pros

  • Very lightweight;
  • Very simple to use;
  • Progressive enhancement – browsers with no support will just have a regular <a> linking to the full-res image;

TODO (= Cons)

  • Figure out if it's acceptably accessible (it probably is! I think)
  • Allow for multiple galleries
  • Opening things other than images

Browser compatibility

I estimate it to be the following: Chrome 38+ (Oct.2014), Edge 79+ (Jan.2020), Firefox 98+ (Mar.2022), Opera 25+ (Nov.2014), Safari 15.4+ (Mar.2022)

Due to:

How about adding (...)?

No, thanks! This is mostly a personal project, fit to my (very) specific needs. If you'd like to add, remove, or change anything, feel free to fork this and build your own personalized version! :)

About

A lightweight, plug'n'play lightbox JS plugin.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published