How to do the image fade-in effect upon scroll (like mashable.com)

Mahmoud Al-Qudsi picture Mahmoud Al-Qudsi · May 1, 2010 · Viewed 22.4k times · Source

I'm wondering about the fade-in effect for images on mashable.com (see http://mashable.com/2009/08/14/google-android-logo-remixes/ for example)

As you scroll to the image, it fades in. It's not fading in on page load, only upon the actual appearance of the item on-screen.

Thanks.

Answer

Vincent picture Vincent · May 1, 2010

It's achieved with the jQuery plugin Lazy Load.

EDIT: Here's the code they used:

if(! navigator.userAgent.toLowerCase().match('ipad')){
  $('#primary img').lazyload({effect:'fadeIn',placeholder:'/wp-content/themes/v6/_base/img/blank.png'});
}