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?

image showing current page , total number of pages

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+''); }); 

example


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -