beg*_*ing 2 carousel twitter-bootstrap-3
我想知道如何使用 Bootstrap Carousel 显示页码。Bootstrap 有轮播指示器(点):

是否可以将指标更改为“第 1/3 页”之类的内容?
我尝试将数字添加到引导标题并将其移动到左侧:

但是,每当我单击下一步时,该号码都不会留在原处。任何想法如何使这更好?
谢谢!
找到了一个有效的解决方案:
var total = $('.item').length;
var currentIndex = $('div.active').index() + 1;
$('#slidetext').html(currentIndex + '/' + total);
// This triggers after each slide change
$('.carousel').on('slid.bs.carousel', function () {
currentIndex = $('div.active').index() + 1;
// Now display this wherever you want
var text = currentIndex + '/' + total;
$('#slidetext').html(text);
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5087 次 |
| 最近记录: |