最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin3浏览0评论

I'm wondering about the fade-in effect for images on mashable (see / 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.

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.

Share Improve this question asked May 1, 2010 at 16:57 Mahmoud Al-QudsiMahmoud Al-Qudsi 29.5k13 gold badges92 silver badges127 bronze badges 1
  • 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: stackoverflow.com/questions/487073/… – Anderson Green Commented Feb 20, 2013 at 18:58
Add a comment  | 

5 Answers 5

Reset to default 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'});
}

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

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

There is a jQuery version of lazyload too.

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

发布评论

评论列表(0)

  1. 暂无评论