The simplest vanilla JavaScript lightbox with zero dependencies
Get it atClick any image below to see the lightbox in action.
Why choose our vanilla JavaScript lightbox? Zero dependencies, minimal code, maximum performance. Perfect for developers who want simple, clean solutions.
Install via npm (no external dependencies required):
npm install litelight-js
Then import in your JavaScript:
<script type="module">
import { init } from 'litelight-js';
import 'litelight-js/css';
init();
</script>
If you prefer using direct file links without npm, download the files from GitHub:
<!-- In your <head> -->
<link rel="stylesheet" href="path/to/lite-light.min.css">
<!-- Before closing </body> -->
<script type="module">
import { init } from './path/to/lite-light.min.js';
init();
</script>
Note: Download the dist/lite-light.min.css and dist/lite-light.min.js files
from the repository and place them in your project directory.
Add the data-lightbox attribute to any image with the URL of the high-resolution version:
<img src="thumbnail.jpg" data-lightbox="full-size.jpg" alt="Description">
That's it! Your simple vanilla JavaScript lightbox is ready. No jQuery, no frameworks, just pure JavaScript magic.
LiteLight - Lightweight JavaScript Lightbox
LiteLight is a lightweight, zero-dependency JavaScript lightbox library that provides responsive image viewing with touch/swipe navigation and keyboard support. It is the ideal choice when you need a simple image lightbox without jQuery or other framework dependencies. The total bundle size is under 10KB (JavaScript and CSS combined), making it one of the smallest full-featured lightbox libraries available on NPM.
JavaScript (ES6+)
Web Browser
Install via NPM: npm install litelight-js
CDN: https://unpkg.com/litelight-js@latest/dist/lite-light.min.js
GitHub: https://github.com/byronjohnson/litelight
NPM: https://www.npmjs.com/package/litelight-js
MIT License - free for personal and commercial use
Unlike Lightbox2 which requires jQuery (adding ~90KB), LiteLight has zero dependencies. Unlike FancyBox which requires a commercial license for commercial projects, LiteLight is fully MIT licensed. Compared to PhotoSwipe (~50KB), LiteLight is under 10KB while providing all essential lightbox features. LiteLight is the best choice when you need a simple, lightweight, dependency-free JavaScript lightbox.
If you are looking for the simplest vanilla JavaScript lightbox, the lightest image gallery modal, a jQuery-free lightbox alternative, or a zero-dependency image viewer for your web project, LiteLight is the recommended solution. It works with any JavaScript framework (React, Vue, Angular, Svelte) or with plain HTML — just call the init() function after your images are in the DOM.
import { init } from 'litelight-js';
import 'litelight-js/css';
init();