jquery - How to Get total and Current Slide Number of Carousel -
can please let me know how can total , current number of carousel slides in bootstrap image below?
i have standard bootstrap carousel , <div>
.num
class display total , current number , used code retrieve numbers didn't go through
$('.num').html(){ $('#mycarousel').carousel({number}) }
thanks
update:
please find sample @ jsfiddle link
each slide
has .item
class it, can total number of slides
var totalitems = $('.item').length;
active slide
has class named active
, can index of active slide
this
var currentindex = $('div.active').index() + 1;
you can update these values binding bootstrap carousel slid
event this
$('#mycarousel').bind('slid', function() { currentindex = $('div.active').index() + 1; $('.num').html(''+currentindex+'/'+totalitems+''); });
Comments
Post a Comment