Is there a way to initialize a Twitter Bootstrap Carousel without an automatic cycle? Setting interval: false
does not cycle initially but once you click on next or prev, it starts cycling again. I don't want it to cycle at all.
Edit
Here is the jquery code that I'm using to initialize it:
$(function() {
$('#carousel').carousel({interval: false});
});
To display an image in the carousel:
image_tag('image.png', :'data-target' => '#carousel', :'data-slide-to' => 1)
You can stop Bootstrap's carousel from cycling on page load by adding data-interval="false"
to your .carousel
div markup. (I wasn't able to get either of the above answers to work.)
I think you are looking for the "data-wrap" parameter
<div id="crsl1" class="carousel slide" data-ride="carousel" data-wrap="false">
...
</div>
$(document).ready(function() {
$('#carousel').carousel('pause');
});
or if that still doesn't do it, try this:
$('#carousel').carousel({interval: false});
$(document).on('mouseleave', '#carousel', function() {
$(this).carousel('pause');
});
to reset the pause on mouseleave event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With