1

順次フェード:

(function sequentialFade (collection, speed) {
    collection.eq(0).fadeIn(speed, function() {
    if (!!collection.length) {
            sequentialFade(collection.slice(1, collection.length), speed);
        }
    }, next());
}($("#f1, #f2, #f3"), 400));

私の機能:

function next() {
    $('#line1').show(1000);
    $('#line1').animate({left: '10px'}, 1000);
}

sequentialFade の完了後に next() 関数を呼び出す方法は?

4

1 に答える 1

0

これを試して、

var speed=5000;// for 5 second
(function sequentialFade(collection, speed) {
    collection.eq(0).fadeIn(speed, function() {
        if (collection.length) //remove !! from if condition
        {
            sequentialFade(collection.slice(1, collection.length), speed);
        }
    });
    next();//call this function outside 

}($("#f1,#f2,#f3"), 400));
function next() {
    $('#line1').show(1000);$('#line1').animate({left: '10px'}, 1000);
}
于 2013-05-28T04:49:59.707 に答える