[英]Bootstrap Carousel - How to get the count on slides
I have the same query as the below post, but I couldn't get it to work. 我有与以下帖子相同的查询,但无法正常工作。
Carousel - Twitter BootStrap ; 轮播-Twitter BootStrap; Hiding the Previous or Next button .
隐藏上一个或下一个按钮 。
Here is my jsfiidle 这是我的jsfiidle
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="carousel-inner">
<div class="active item"><img src="http://twitter.github.io/bootstrap/assets/img/bootstrap-mdo-sfmoma-01.jpg">
</div>
<div class="item"><img src="http://twitter.github.io/bootstrap/assets/img/bootstrap-mdo-sfmoma-02.jpg"></div>
<div class="item"><img src="http://twitter.github.io/bootstrap/assets/img/bootstrap-mdo-sfmoma-03.jpg"></div>
</div>
</div>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div>
$(document).ready(function () {
// -------- Initialise Carousel -------- //
$('.carousel').each(function(){
$(this).carousel({
interval: false
})
});
});
I just made a quick example, basically it's listening to the slid
event and every time the slide animation is done it will check which one the active slide is, based on that you can check whether it's the first or the last one. 我只是举了一个简短的例子,基本上它是在监听
slid
事件,每次播放幻灯片动画时,它都会检查活动幻灯片是哪一张,然后您可以检查它是第一张还是最后一张。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.