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 回答