Reputation: 717
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>
Upvotes: 1
Views: 2732
Reputation: 31
Here is a simple way to obtain what you actually need. Just replace the first line in your code with this one,
<div id="myCarousel" class="carousel slide" data-wrap="false"><!-- Carousel items -->
And then it should cycle only once. Hope this helps you.
Cheers!!!
Upvotes: 3
Reputation: 16116
You can do something like this
<script>
var imgCount = 3;
$('#myCarousel').carousel({
interval: 2500
});
$('#myCarousel').bind('slid',function(){
imgCount--;
if(imgCount == 0)
$('#myCarousel').carousel('pause');
});
</script>
Upvotes: 1