W3C home > Mailing lists > Public > public-web-perf@w3.org > May 2013

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

From: Vincent Voyer <Vincent.Voyer@gmail.com>
Date: Thu, 2 May 2013 00:36:11 +0200
Message-ID: <CAPdVrO8uB764WPj=tSDS9VJxFYK3q7nbTBvRJ7Q7Bdzg8siUHw@mail.gmail.com>
To: public-web-perf@w3.org
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

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:
Received on Thursday, 2 May 2013 04:20:11 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:04:35 UTC