Javascript Image Slider > Posts >

 

How do you stop images from rotating after last image

Don
one year ago
Viewed: 1252
2
Useful
How do you stop the rotator from going to the first image after it's completed one cycle? Thanks!

one year ago
Taylor   Edit
0

You can implement this by using the slider's built-in functions and event handlers that are listed in Demo 4 Image Slider with Navigation Buttons.

Suppose you have 5 slides in total. Your last frame will be index=4. Add the following event handler to your page inside the script tag: <script> ... </script>
function beforeSlideChange(args) { //args[0]-next slide index, args[1]-next image, //args[2]-next caption, args[3]-next effect if(args[0]==4) imageSlider.changeOptions({ autoAdvance: false }); }
Note:
  1. The afterSlideChange event handler is only available for licensed slider.
  2. You can also use afterSlideChange handler. But you need to use index 3 instead.
    function afterSlideChange(args) { //args[0]-currentSlide index, args[1]-currentImage if(args[0]==3) imageSlider.changeOptions({ autoAdvance: false }); }


New Answer