Ninja Slider / Posts /

How to make the slider stop at the last slide

Can anyone tell me how to make the responsive slider stop at the last slide?
Dragen  3 years ago   viewed: 6682    

3 Answers


We can use the build-in before or after event handler and the toggle function to accomplish the task. Suppose you have 4 slides in the slider:

In the nsOptions of the ninja-slider.js, you will find the before variable:

var nsOptions = { ...... before: null, ...... }
You can set it to:
var nsOptions = { ...... before: function (currentIdx, nextIdx, manual) { if (nextIdx == 3) nslider.toggle(); }, ...... }
Note: the index number is zero-based.
Milo   3 years ago
this will make the slide stop, but how to continue from slide 0 while reaching the last slide; instead of showing all slides navigation to reach at slide 0. (in simple can the slider continues slides from slide 0 when it reach last slide instead of showing the whole slides in reverse mode?)
  3 years ago
Yes it is the continuous sliding without reversing back since the version 2015.10.26.
Milo   3 years ago


Your name*
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: