The Absolute Best Lazy Load Javascripts

In a field dominated by imagery, using the best lazy load javascripts possible can help you deliver amazing impact without becoming an absolute drag on your pageload times.

Web designers are constantly weighing two factors - form and function. The value of pictures really can't be overstated, but they do come with their own drawbacks... most notably the size. Anyone old enough to remember the "dial-up" days can certainly attest to the bandwidth imagery can occupy. As the value of providing a solid user experience grows, including images judiciously and providing them efficiently becomes a field all of its own. To that end - lazy loading images seem to be the best solution. Ultimately the goal is to delay loading an image until it's actually needed by the viewer. Wherever the field web design expands, that seems like a resolution that should remain useful for quite some time. While researching different lazy loading approaches for a recent project we decided to keep a few notes so we can provide our visitors with a definitive list of the absolute best lazy loading javascripts. We've included the best options currently available, along with some sample code snippets, and a few performance tips to have your project humming in no time!

Best Lazy Load Javascripts List

It should go without saying but the previous examples are based on a "nothing.gif" "holder file" in the root, an image named "yourimage.jpg" in a folder named "img", and an individual ".js" file in a "js" folder.

Lazy Loading Details and Specs

There are a few questions that you need to ask about your particular project. Do you rely on responsive images? Do you have iframes/videos to include? Are you running JQuery? Are you building from command line? Figure out what you need, make sure you've planned ahead a bit, then make sure you utilize the simplest approach possible that fits those needs. If the description above and details below meet your needs, plug in your favorite lazy loading javascript, customize your initialization, and start tuning away.

  • Unveil.js
  • v1.3
  • 770b
  • JQuery
  • MIT
  • LL for JQuery
  • v1.9.3
  • 4kb
  • JQuery
  • MIT
  • JQuery LL XT
  • v1.0.6
  • 2kb
  • JQuery
  • MIT
  • Responsive LL
  • v0.1.8
  • 4kb
  • Agnostic
  • MIT
  • Echo.js
  • 1.7.0
  • 1.9kb
  • Agnostic
  • MIT
  • VVO
  • v3.2.1
  • 4kb
  • JQuery
  • MIT

* Sizes based on Minimized / GZipped single file size.

Performance Considerations

If you’re looking for additional performance for your website you’ll want to take two major things into consideration, the first being your javascript loading. Each approach is slightly different, but there are a few constants to keep in mind. If your lazy loading script depends on JQuery (which it probably does), make sure that it is loaded before your lazy loading javascript. Depending on what else is loading on that page, your best bet for speeding up your performance is to tailor your "Async" and "Defer" elements. There is a very useful explanation of those attributes illustrated on this post on HTML5Rocks. The basic idea here is to identify those specific scripts as "Asynchronous Friendly" or "Defer-able", introduce them early in the pageload, then actually load them later.

The second large consideration pertains to how "search engine friendly" your images are. If you set your script to load EVERY image on your site, none of those images technically "load" with the page. This will make the page load faster, but since the images aren't there when the page loads, they're not really "crawl-able". If images mean nothing to your site then that approach is certainly easiest, but if you have a image that you want search engines to see there is a pretty easy workaround. Just include a "noscript" version of the image in your code (see sample below) directly after the lazy loaded image.

NoScript Workaround Example

By lazy loading unimportant images and applying a "noscript" patch to the important ones, you can achieve a nice balance of speed and search engine image inclusion. If you want to keep things a little future proof, you might also note that HTML5 identifies "data-original" as the preferred attribute identifier. That likely means that some day search engines will crawl those url's, but for now - that little "noscript" hack seems to do the trick very well.

<noscript><img src="/img/yourimage.jpg" alt="alt" title="title" /></noscript>
Well Done - You Get a High-Five

Hopefully this post has given you some guidance on which lazy loading javascripts are solid options and how to integrate them into your project. If you have any general questions or guidance, please feel free to include it in the comments below and we'll take those into consideration on updates. As always thanks for dropping by and if you've found this post useful be sure to share it with the social buttons below.

  • Published:
  • Author:
  • Category: technology
  • Share:
  • Title: The Absolute Best Lazy Load Javascripts
  • Summary: Using the best lazy load javascripts help you deliver high impact without dragging down your server speed or pageload times.