Re: <img src="..." defer>

Hi, I read most of this thread, very interesting.

I wrote dirty hacks to get lazyload right on websites :
https://github.com/vvo/lazyload and it works of course.

How could we do that more easily and less hacky?

We would need:


- a lazy attribute that will inform the browser to not download a
resource but leave the developper deals with it (image, iframe, ..)
- an inViewport event with an offset feature so that I can get an
event when an element is x pixels near the viewport.

Then I'll just watch all my images with a lazy attribute and remove
the lazy attribute when they are in viewport.
As soon as I remove the lazy attribute, browser knows it can download the image.

I know this is far from what have been proposed and I'm very late but
still this is what I'll need if I wanted to implement a simple
lazyloader.

The inViewport event would be interesting for a lot of other use cases.
The lazy attribute is simple and cute: I'm a lazy element, leave me
alone untill you really want me to download.

For the inViewport event it seems someone had a similar idea recently:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=20246

Received on Thursday, 2 May 2013 04:20:11 UTC