How to stop jquery Cycle 2 on certain slide number?

384 views Asked by At

I have Cycle2 carousel on auto play. Does someone know how to stop Cycle2 carousel on certain slide?

Using $('.cycle-slideshow').on('cycle-update-view', function (e, optionHash, slideOptionsHash, currentSlideEl) { var caption = (optionHash.currSlide + 1) ; //alert(optionHash.currSlide);

     if(optionHash.currSlide == 3){
          $('.cycle-slideshow').cycle('stop');

     }

    });
});

make carousel jump on slide 3 instead of slide on side # 3 and stop.

Thanks for any hint.

1

There are 1 answers

0
marb On

This worked for me : $( document ).ready(function() {

$('.cycle-slideshow').on('cycle-update-view', function (e, optionHash, slideOptionsHash, currentSlideEl) { var caption = (optionHash.currSlide + 1) //+ ' of ' + optionHash.slideCount; //alert(optionHash.currSlide);

     if(optionHash.currSlide > 2){
          $('.cycle-slideshow').cycle('pause');
     //do something else
     }

    });

});