LiteLight

The simplest vanilla JavaScript lightbox with zero dependencies

Get it at

How to Use This Simple Vanilla JavaScript Lightbox

  • Click on any image to open it in the zero-dependency lightbox
  • Arrow keys (← →) to navigate between images - pure JavaScript navigation
  • Swipe left/right on mobile devices to navigate (vanilla JS touch events)
  • ESC key or click outside the image to close the simple lightbox
  • Click the X button to close the vanilla JavaScript modal

Simple 3-Step Implementation

Why choose our vanilla JavaScript lightbox? Zero dependencies, minimal code, maximum performance. Perfect for developers who want simple, clean solutions.

Step 1: Include the Files

Add the CSS and JavaScript files to your HTML (no external dependencies required):

<link rel="stylesheet" href="lite-light.min.css">
<script type="module">
  import { init } from 'lite-light.min.js';
  init();
</script>

Step 2: Add Data Attributes

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">

Step 3: You're Done!

That's it! Your simple vanilla JavaScript lightbox is ready. No jQuery, no frameworks, just pure JavaScript magic.

Why Vanilla JavaScript?

  • ✓ Faster loading - no framework overhead
  • ✓ Smaller bundle size - under 10KB total
  • ✓ Better performance - optimized vanilla JS
  • ✓ Future-proof - no dependency updates needed
  • ✓ Universal compatibility - works everywhere