8

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.

Mahmoud Al-Qudsi
  • 26,006
  • 12
  • 71
  • 118
  • 1
    You can determine whether an HTML element is visible on a page using JQuery, and call any function as soon as it becomes visible: http://stackoverflow.com/questions/487073/check-if-element-is-visible-after-scrolling – Anderson Green Feb 20 '13 at 18:58

5 Answers5

9

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'});
}
Vincent
  • 3,784
  • 2
  • 20
  • 29
1

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

RRG
  • 457
  • 5
  • 18
1

There is a jQuery version of lazyload too.

alain.janinm
  • 19,035
  • 10
  • 56
  • 103
murrydan
  • 11
  • 1
1

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! ;-)

Tárcio Zemel
  • 501
  • 6
  • 24
0

A YUI version is available too. In fact, Lazy Load was inspired by it.

Drew Noakes
  • 266,361
  • 143
  • 616
  • 705