1

私は問題なくjquery.cycle()を使用しています>

ただし、上司は、スライドを2回ループしてから、最初のスライドで停止することを望んでいます。

自動停止で1回ループできることがわかります。しかし、スライドショーが2回ループするように指定するにはどうすればよいでしょうか。

できますか?

4

3 に答える 3

3

使用autostopCount: http://jquery.malsup.com/cycle/options.html

autostop:0,     // true to end slideshow after X transitions (where X == slide count) 
autostopCount: 0,     // number of transitions (optionally used with autostop to define X) 

別のオプション、それが私が思うように機能しない場合:

$(document).ready(function(){
    var index = 1;
    var interval = setInterval(function(){
        $('#slideshow').cycle('next');
        index++;
        if(index == cycleLength*2) {
            clearInterval(interval);    
        }
    }, 1000);
});

自分で用意する必要がありcycleLengthます。

于 2012-05-21T21:45:57.997 に答える
2

以前の回答を説明するために、X がhttp://jsfiddle.net/lucuma/LKUyg/に移行した後に最初のスライドで停止する実際のコード:

var numberReptitions = 2;

$('#slideshow').cycle(
    {
        autostop:1,     // true to end slideshow after X transitions (where X == slide count) 
        autostopCount: ($('#slideshow').children().length*numberReptitions)+1
});​
于 2012-05-22T15:14:49.457 に答える
2

リトルビッグボットに加えて、

目的のロジックに基づいて「after」イベントをチェックすることで、サイクルを一時停止できます

var numberOfImages = 3;var counter=0;
after: function(currSlideElement, nextSlideElement, options, forwardFlag)   {
    counter++;
    if(counter > numberOfImages*2) 
        $('#slideshow').cycle('pause');
}
于 2012-05-21T22:13:22.053 に答える