Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 608
Mahmoud Al-Qudsi Avatar asked May 01 '10 16:05

Mahmoud Al-Qudsi


4 Answers

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'});
}
like image 51
Vincent Avatar answered Oct 18 '22 18:10

Vincent


Found the mootools version of the lazyload http://davidwalsh.name/mootools-lazyload

like image 25
RRG Avatar answered Oct 18 '22 19:10

RRG


Unfortunatelly, the Lazy Load plugin not works in most actual browsers, according the own author says in the official web site.

But the jQuery Appear Plugin do almost the same thing! ;-)

like image 1
Tárcio Zemel Avatar answered Oct 18 '22 20:10

Tárcio Zemel


There is a jQuery version of lazyload too.

like image 1
murrydan Avatar answered Oct 18 '22 19:10

murrydan