how to get the total number of slides in flexslider

flexslider, javascript, jquery

Solution

Base on the demo here

I notice the demo and others will generate the code like below :

<ol class="flex-control-nav flex-control-paging">
    <li><a class="">1</a>
    </li>
    <li><a class="flex-active">2</a>
    </li>
    <li><a>3</a>
    </li>
    <li><a>4</a>
    </li>
</ol>

So according this, you can get what you want using the code:

var index = $('li:has(.flex-active)').index('.flex-control-nav li')+1;
var total = $('.flex-control-nav li').length;

Problem

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?

Original source