1

I am using multiple instances of Cycle for a portfolio; Only one is shown and the others are hidden. Each Cycle is a project with multiple images.

The only thing I can't figure out is how to detect the end of the « current » Cycle instance.

with after: function, it is triggered for all instances at once, impossible to get « local » events.

Here is my code :

    $('.sldr_closeup').each(function() {
    var currId = $(this).attr('id');
    window['num_'+currId] = 0;
    $(this).cycle({
        timeout:0,
        speed:500,
        fx:'fade',
        next:'.nextimages',
        prev:'.previmages',
        fit:1,
        nowrap:1,
        autstop:0,
        after : function(c,n,o,f) {

            var currId = $(this).parent('div').attr('id');

            (f) ? window['num_'+currId] ++ : window['num_'+currId] --;
            if ((o.slideCount == window['num_'+currId] )) {

                alert(currId);
                $('.nextimages').stop().fadeTo(400,0,function(){
                    if(currId != $('.projectList .projet').last().find('a').attr('rel'))
                        $('.nextproject').stop().fadeTo(400,1);
                    $(this).hide();

                });
            }
        }
    }).cycle('pause');

});
4

1 回答 1

0

你有没有尝试过

end:...,

见这里:http: //jquery.malsup.com/cycle/options.html

于 2012-06-12T11:37:59.410 回答