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

Lukasz Adamski
Lukasz Adamski
11,660 Points

How to load images in the hero image section above the fold first

How to load images in the hero image section above the fold first, and potentially styles for it first before loading the whole page? Chrome dev tool in audits recommends things like: https://developers.google.com/web/tools/lighthouse/audits/offscreen-images and https://developers.google.com/web/updates/2016/04/intersectionobserver

How compatible are these solutions for the current web browsers and did anyone use them? I plan to create web pages for very long, 1 column sales pages that have a lot of text and content in it. It would be great to optimize the speed by loading the images and styles for the above the fold section first, and load other sections while scrolling or by hitting some kind of thresholds.

1 Answer

I am using Lighthouse with Chrome (Version 67.0.3396.99) and it works fine ... it also provides lots of insights about the speed of your page and gives suggestions about the things you might want to change ... also I use ImageOptim ... which can always squeeze out at least a few KB per image, even though I already tried my best to compress them well ...