NitroShock Image Lightbox

Description

NitroShock Image Lightbox gives every linked image on your site an instant full-screen lightbox – no jQuery, no icon fonts, no external requests. Just one small deferred script and a little CSS, loaded only on pages that have a lightbox image.

Why NitroShock Image Lightbox?

  • Zero dependencies – pure vanilla JS, nothing extra to load.
  • Auto-detect – wraps any <a href="image.jpg"><img></a> automatically, exactly as WordPress outputs them.
  • Oxygen Builder ready – re-scans the page when Oxygen finishes its dynamic render.
  • Scrolling gallery – group images by CSS class, rel, or data-nlb-group and swipe/arrow through them.
  • Pan & zoom – scroll-wheel, double-click, pinch-to-zoom, drag-to-pan with pointer-anchored zooming.
  • Keyboard + touch – Arrow keys, Escape, and left/right swipe all work out of the box.
  • Preloads adjacent images in the background so navigation feels instant.
  • GPU-only animations – smooth 60 fps on mobile; respects prefers-reduced-motion.
  • Accessible – role="dialog", aria-modal, focus management, focus-visible ring.
  • Shortcode – [nitrolitebox] for full control over any image.

Works with

Standard WordPress themes (Twenty Twenty-Five, Astra, GeneratePress, Kadence, Blocksy, OceanWP, etc.), Oxygen Builder, Elementor, Beaver Builder, Bricks, and any page builder that outputs standard linked images.

Shortcode example

[nitrolitebox src="https://example.com/full.jpg" thumb="https://example.com/thumb.jpg" caption="My caption" group="gallery1"]

Developer API

`js

// Open programmatically
NitroLiteBox.open(‘https://example.com/image.jpg’);

// Open a gallery
NitroLiteBox.open([
{ src: ‘https://example.com/a.jpg’, caption: ‘First’ },
{ src: ‘https://example.com/b.jpg’, caption: ‘Second’ },
]);

// Re-scan after dynamic content loads
NitroLiteBox.refresh();
// or dispatch the custom event:
document.dispatchEvent(new CustomEvent(‘nlb:refresh’));
`

Screenshots

Installation

  1. Upload the nitroshock-image-lightbox folder to /wp-content/plugins/.
  2. Activate through Plugins Installed Plugins.
  3. That’s it – linked images become lightboxes automatically.

For settings, visit Settings NitroShock Lightbox.

FAQ

Will it conflict with my theme’s existing lightbox?

NitroShock Image Lightbox only activates on links it detects. If your theme ships its own lightbox and already handles those links, disable auto-detect in Settings and use data-nitrolitebox attributes or the shortcode on specific elements instead.

Does it work with Oxygen Builder galleries?

Yes. The lightbox re-scans the page when Oxygen fires its oxygen-done event after a dynamic render. Oxygen’s gallery links already follow the standard <a href="full.jpg"><img></a> pattern, so they are picked up automatically.

How do I group images into a scrolling gallery?

Three ways: add a shared CSS class like nlb-group-portfolio (new in 1.1), use data-nlb-group="my-set", or let WordPress add the rel attribute automatically for gallery blocks.

Can I open the lightbox with JavaScript?

Yes: NitroLiteBox.open('https://example.com/image.jpg') or pass an array of objects with src and caption keys.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“NitroShock Image Lightbox” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.2.0

  • Renamed to NitroShock Image Lightbox.
  • Prepared for the WordPress.org plugin directory. Updates now come from WordPress.org; the built-in update checker is removed.
  • Styles and scripts are now loaded only through the WordPress enqueue functions. The lightbox script is deferred and its small stylesheet is printed inline, so neither blocks rendering. The settings page styles load from their own stylesheet on that page only.
  • Settings are stored under a new option name, nitrolitebox_settings.
  • Internal PHP function names now use the full nitrolitebox_ prefix and constants use NITROLITEBOX_.
  • Settings page text is translatable.

1.1.5

  • The lightbox files now load only on pages that contain a lightbox image (in post content, blocks, shortcodes, widgets, or Oxygen elements) instead of on every page.
  • New “Load on every page” setting restores the old behaviour for image links placed outside those areas, such as hard-coded in a theme template. Setting Extra selectors also loads it everywhere. Developers can use the nitrolitebox_force_load filter.
  • Saved settings now apply on the front end. Previously the settings page stored them but the lightbox always used the defaults.
  • Fixed the caption showing as a thin wrapped column beside the image while a large image was still loading. The caption now stays hidden until the image has loaded.

1.1.4

  • Replaced typographic dashes with plain hyphens across the plugin output.

1.1.3

  • Corrected the Oxygen Builder re-init comment in the plugin output.

1.1.2

  • Escaping and translator-comment fixes found with Plugin Check.
  • Fixed the “Visit Plugin Site” link in the NitroShock footer card pointing to the wrong plugin when several NitroShock plugins are active.

1.1.0

  • Added full pan & zoom — scroll-wheel, double-click, pinch-to-zoom, drag-to-pan.
  • Added class-based gallery grouping — any shared nlb-group-* class auto-groups images.
  • Added zoom toggle button (magnifier icon, top-right of lightbox).
  • Added keyboard shortcuts: +/- zoom, 0 reset zoom.
  • Esc now resets zoom first before closing.
  • Navigation arrows dim and disable while zoomed.
  • Added NitroLiteBox.setZoom() and NitroLiteBox.resetZoom() to the JS API.
  • Settings: added Zoom enable/disable, Max zoom level, Group class prefix fields.
  • PHP: added zoom, zoomMax, zoomStep, groupClassPrefix to options.

1.0.0

  • Initial release.