Post #1158405
2026-04-13 06:19 UTC
Replies (2)
-
@mateus@tech.lgbt 2026-04-13 07:05
@normplum@fosstodon.org the main benefit would be not downloading the hundreds of images. If the user never advances past the first page, they never need to download more than the first page's images. Depending on the size of the images, that could save tons of bandwidth. A few lines of purpose-built JS could go a long way. But, pulling in a huge library for that purpose would negate the savings. So, choose carefully
-
@idiomatic@mastodon.social 2026-04-13 08:27
@normplum@fosstodon.org If you're concerned about loading a ton of images all at once, when the user might not even scroll down to see them, you could just pop `loading="lazy"` on each ``. You'll also need the width and height attributes, if you know them, to support Firefox. This should defer the request for each of those unseen images until they're actually in the viewport. Whether this is the right solution depends on the specifics of your project, but it's simpler than implementing pagination!