News for hackers. Stuff that matters.
Re:Show HN: Gandul – accessible image lazy loading by fake-name on Wednesday April 17, 2019 @09:18PM (#19687922)
Or maybe, and this might sound crazy, just USE THE FUCKING IMAGE TAG.

Seriously, websites where the images are broken without javascript are FUCKING ANNOYING.

There are image formats that support progressive rendering. Use those if you're that desperate, but STOP BREAKING THE FUCKING INTERNET FOR NO GOOD REASON.

Re:Show HN: Gandul – accessible image lazy loading by antibland on Wednesday April 17, 2019 @09:47PM (#19688067)
Native lazy-loading[0] is coming in Chrome 75.

<img src="celebration.jpg" loading="lazy" alt="..." />

[0] https://addyosmani.com/blog/lazy-loading/

Re:Show HN: Gandul – accessible image lazy loading by Diti on Thursday April 18, 2019 @04:20AM (#19689566)
Great⸮ As a regular underground public transportation commuter (without a data connection, except at very specific stations), I might soon have to scroll through an entire page of lazy-loaded images to ensure the page will be accessible for consumption during my trip!

But it’s a good thing, textual content will be easier to consume.

Re:Show HN: Gandul – accessible image lazy loading by tyingq on Wednesday April 17, 2019 @10:28PM (#19688256)
With some caveats, like "An implementation detail of loading in Chrome is that it fetches the first 2KB of images on page-load.".

That's the first 2KB of every image.

Re:Show HN: Gandul – accessible image lazy loading by Traubenfuchs on Thursday April 18, 2019 @07:14AM (#19690142)
So on the server side I will have lots of errors/exceptions because only 2kb were loaded of each image?
Re:Show HN: Gandul – accessible image lazy loading by tyingq on Thursday April 18, 2019 @07:20AM (#19690165)
I assume it does a range request. I was more pointing out that the client will still make a lot of requests. So maybe still not a good approach for long pages with tons of images below the fold.
Re:Show HN: Gandul – accessible image lazy loading by osrec on Wednesday April 17, 2019 @10:05PM (#19688159)
My webpage might need to load 1000 images eventually. It's kinda inefficient to try and load them all at the start, especially if the user is never going to scroll through all of them.

Also, progressive rendering solves an entirely different problem.

Re:Show HN: Gandul – accessible image lazy loading by hallman76 on Wednesday April 17, 2019 @11:41PM (#19688535)
> My webpage might need to load 1000 images eventually. It's kinda inefficient to try and load them all at the start, especially if the user is never going to scroll through all of them.

That's a fair concern, but this library won't help with that.

Re:Show HN: Gandul – accessible image lazy loading by lpghatguy on Wednesday April 17, 2019 @06:03PM (#19686867)
Rendering an anchor in the place of an image in case I don't have JavaScript enabled doesn't feel very good.

I'd much rather have image solutions that fail gracefully if the JS on my page is broken or the user just has it disabled.

Re:Show HN: Gandul – accessible image lazy loading by duhi88 on Wednesday April 17, 2019 @06:45PM (#19687088)
Why not? I think it is a fair replacement for a lot of image use-cases. If JS is turned off, users still have the ability to view the image and description, without the image hurting your total page weight.
Re:Show HN: Gandul – accessible image lazy loading by keanebean86 on Wednesday April 17, 2019 @11:20PM (#19688456)
Have a style sheet at the bottom of the page below some js. The js sets up lazy loading and changes all the image div id/classes so the style sheet does nothing. The style sheet sets the image divs backgrounds to your images otherwise. That should still work without js. Although it's a mess to work with...
Re:Show HN: Gandul – accessible image lazy loading by bastawhiz on Wednesday April 17, 2019 @06:32PM (#19687018)
It would be nice if they supported an anchor with a noscript tag inside containing the image
Re:Show HN: Gandul – accessible image lazy loading by revskill on Wednesday April 17, 2019 @07:36PM (#19687367)
How about lazily turn <a> into <img> without hurting performance ? It's useful if the network is slow.
Re:Show HN: Gandul – accessible image lazy loading by zichy on Thursday April 18, 2019 @04:56AM (#19689683)
I don't get why this is supposed to be particular accessible. <img> is perfectly fine, the alt attribute should describe the contents for users with screen readers and crawlers.
Re:Show HN: Gandul – accessible image lazy loading by kingkool68 on Wednesday April 17, 2019 @05:57PM (#19686826)
I really dig this approach. Pretty clever.
Re:Show HN: Gandul – accessible image lazy loading by JorgeGT on Wednesday April 17, 2019 @05:06PM (#19686484)
Nice name!