Elektrine lite

← Feed

@idiomatic@mastodon.social

Post #2898683

2026-04-13 08:27 UTC

@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!

Replies (1)

  • @normplum@fosstodon.org 2026-04-13 10:32

    @idiomatic@mastodon.social That's awesome, thanks! I knew about lazy loading from years ago, but thought it was only a JS library thing. I had no idea it was a supported HTML attribute now. Just added it to my code and it works perfectly.

    Open ##2898684