Showing Slide Count with Nivo Slider

前端 未结 2 1600
后悔当初
后悔当初 2021-01-15 19:12

I would like to show the slide count as 2 of 10 on my slider. How do I make it work with the transitions 3 of 10, 4 of 10 (as the slid

2条回答
  •  醉话见心
    2021-01-15 19:58

    You would need to look for the clickhandler and or transition event. I haven't used nivo yet but this is the concet you need to do:

    parent = $('#buttons'); // button container
    pages = parent.find('.button').size; // total number of pages
    
    parent.find('.button').click(function(){
      index = parent.index($this) + 1; // this is the the page number
    
      //do something with these variables
      $('#div1').html(index + ' of ' + pages); 
    });
    

提交回复
热议问题