Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 ...