Menu

How a WordPress gallery starts at 3 KB of JavaScript
📰

How a WordPress gallery starts at 3 KB of JavaScript

DEV Community: css·Niklas P·3 days ago
#O5dLtyMk
#devtocss#devto#dev#gallery#script
Long article (1409 words) — no AI summary yet.
Reading 0:00
15s threshold

For a long time a WordPress gallery meant jQuery, a masonry library, a lightbox library and an animation library, loaded on every page just in case. In 2026 the browser does most of that work itself. This is how Wisp Gallery gets by with about 8 KB of its own JavaScript, and what that looks like measured.

Why galleries needed all that script

A gallery has a few hard problems: placing photos of different shapes without gaps, showing one large photo over the page, scrolling a row of photos sideways, animating photos as they appear, and filtering them without a jump. Ten years ago each of these needed JavaScript – and jQuery made that JavaScript easier to write across browsers. Plugins that started then still carry that stack, and it shows: the free versions of the popular gallery plugins load between about 20 and 75 KB of gzipped JavaScript for a default gallery with a lightbox, on top of jQuery’s roughly 35 KB.

Every one of those problems now has a native answer.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.