how to get the total number of slides in flexslider

gadss picture gadss · Feb 1, 2013 · Viewed 17.7k times · Source

I am using flexslider http://www.woothemes.com/flexslider/ , now I want to get the total number of the slides and the number of the sildes.

number of the slide/total number of the slides

for example if I have 5 slides and I am now in 2nd slide, so this will be the output below the slides.

2/5

if I click the "next nav" it will become

3/5

if "prev nav";

2/5

It is possible in flexslider? if yes, how to do it?

Answer

Leissa picture Leissa · Aug 26, 2013

You can find the answer here:http://www.woothemes.com/flexslider.

    <script type="text/javascript" charset="utf-8">
      $(window).load(function() {
        $('.flexslider').flexslider({
          animation: "slide",
          controlsContainer: ".flex-container",
          start: function(slider) {
            $('.total-slides').text(slider.count);
          },
          after: function(slider) {
            $('.current-slide').text(slider.currentSlide);
          }
       });
     });
    </script>

If you want even the first slide to be counted you can add in the start function:

$('.current-slide').text(slider.currentSlide);

If you want the current-slide to begin with number 1 (not 0) you can do:

$('.current-slide').text(slider.currentSlide+1);