jQuery Cycle different speed on each slide transition

jQuery Cycle different speed on each slide transition

I'm trying to control dinamically the speed of the transition between slides using the before event and using the options object to update the speed, but I'm not having success.

Look at this sample code to understand what I'd like to do:
  1. <div id="slideshow">
  2.       <img src="img0.jpg" />
  3.       <img src="img1.jpg" />
  4.       <img src="img2.jpg" />
  5.       <img src="img3.jpg" />
  6.       <img src="img4.jpg" />
  7.       <img src="img5.jpg" />
  8.       <img src="img6.jpg" />
  9. </div>
  10. <a id='prev' href="#">Prev</a>
  11. <a id='next' href="#">Next</a>


  12. <script type="text/javascript">


  13. function onBefore(curr, next, opts) {
  14.     if( $.inArray(opts.nextSlide, [2,4,6] )) 
  15.         opts.speed = 1000;
  16.     else 
  17.         opts.speed = 5000;
  18. }


  19.   $("#francesca-slideshow").cycle({ 
  20.       fx:     'fade', 
  21.       prev:   '#prev', 
  22.       next:   '#next',
  23.       before:   onBefore
  24.   });


  25. </script>


Does anyone now if this is possible this way?

Thanks in advance and congrats to  Malsup for the great job 
    • Topic Participants

    • info