Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Elwin de Witte
Elwin de Witte
1,357 Points

Multi-stage image loading

Hi everyone,

I'm working on a website and I would like to have images enhance in quality when loading. For instance; 1st one: 720p 2nd: 1080p 3rd: 2160p. How do I do this?

Thanks for your help!

1 Answer

Try this one and tell why it's not the way you need. https://api.jquery.com/load-event/

ยซFor example, consider a page with a simple image:

<img src="book.png" alt="Book" id="book">

The event handler can be bound to the image:

$( "#book" ).load(function() {
  // Handler for .load() called.
});

As soon as the image has been loaded, the handler is calledยป.