{"id":291777,"date":"2019-07-01T07:16:24","date_gmt":"2019-07-01T14:16:24","guid":{"rendered":"http:\/\/css-tricks.com\/?p=291777"},"modified":"2019-07-15T06:54:18","modified_gmt":"2019-07-15T13:54:18","slug":"tips-for-rolling-your-own-lazy-loading","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/tips-for-rolling-your-own-lazy-loading\/","title":{"rendered":"Tips for rolling your own lazy loading"},"content":{"rendered":"

You may have heard (or even issued the call) that \u201cwe can just use lazy loading!\u201d when looking for a way to slim down a particularly heavy web page.<\/p>\n

Lazy loading is a popular technique for gradually requesting images as they come into view, rather than all at once after the HTML of the page has been parsed. It can reduce the initial page weight, and help us hit our performance budgets<\/a> by requesting images when they’re needed.<\/p>\n

It can be effective. But it also comes with some baggage of its own. We\u2019ll get to that! In fact, Rahul Nanwani did an extensive write-up that hits several lazy-loading methods<\/a> and illustrates just how complex some are.<\/p>\n

In this post, we\u2019ll look at an implementation that’s already been covered in brief detail in this post by Preethi<\/a>. We’re going to expand on that so you can add your own implementation of lazy loading to your site as I\u2019ve done on this little demo site<\/a>.<\/p>\n

<\/p>\n

We\u2019ll cover these topics along the way:<\/p>\n