Bootstrap 2轮播循环一次,然后停止 [英] Bootstrap 2 Carousel cycle once and then stop

查看:86
本文介绍了Bootstrap 2轮播循环一次,然后停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Bootstrap 2轮播循环一次,然后停止.我想我对如何实现这种目标有点迷惑了!香港专业教育学院尝试周期和间隔,但我只是找不到足够的文档,有关如何使此特定功能

Bootstrap 2 Carousel cycle once and then stop. I suppose I am a bit lost as to how to make this happen! Ive tried cycle and interval but i just cant find enough documentation on how to make this specific function

编辑---我的代码很简单!

Edit --- My code is pretty simple!

<div id="myCarousel" class="carousel slide"><!-- Carousel items -->
<div class="carousel-inner">
<div class="active item"><img src="images/carousel/slide-1.png" /></div>
<div class="item"><img src="images/carousel/slide-2.png" /></div>
<div class="item"><img src="images/carousel/slide-3.png" /></div>
</div>
</div>
<script>
$('#myCarousel').carousel({
        interval: 2500
})
</script>

推荐答案

您可以执行以下操作

<script>
   var imgCount = 3;
   $('#myCarousel').carousel({
       interval: 2500
   });
   $('#myCarousel').bind('slid',function(){
      imgCount--;
      if(imgCount == 0)
        $('#myCarousel').carousel('pause');  
   });
</script>

这篇关于Bootstrap 2轮播循环一次,然后停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆