2013-10-23 246 views
1

我使用jQuery淡入一組列表項,在它從上到下逐漸消失的時刻; 我想從下往上淡入。當最下面的列表項在瀏覽器中可見時,該功能被觸發。顛倒動畫的順序與jQuery

An example is here.

由於條件的限制,我不能簡單地撥動名單下令各地,這可能嗎?

我看了一下可能

.reverse() 

選項,但還沒有找到一種方法來實現它。

在此先感謝。

回答

0

替換您如下代碼:

$(".chart.electric li, .chart.fuel li").each(function (index) 

這一個:

$($(".chart.electric li, .chart.fuel li").get().reverse()).each(function (index) { 

working demo

0

試試這個..添加反向您的每

http://jsfiddle.net/HxFfH/12/

jQuery.fn.reverse = [].reverse; 

    $(".chart.electric li, .chart.fuel li").reverse().each(function (index,el) { 
     $(el).delay(100 * index).animate({opacity: 1}, 1000); 
    });