Reputation: 1250
It's possible to set the interval for a Boostrap carousel in jQuery with this code:
$('.carousel').carousel({ interval: 1000 * 10 });
My question is:
How can I get the interval?
My intention is to start the carousel with the default interval, and to slow it down after each transition. That way people say right away there is a slide show, but have more and more time to read the captions as the slideshow slows down.
Thanks.
Upvotes: 0
Views: 297
Reputation: 5897
Try using my plugin or Bootstrap carousel: https://github.com/silviomoreto/bootstrap-carousel
It wraps the carousel plugin in a more readable way. There, set the interval with:
$('.carousel'). bCarousel({'interval': 1000});
Upvotes: 0
Reputation: 20383
You can change carousel options after start. Here is a simple example that will reduce speed by half on each cycle, by doubling the interval option.
var carousel = $('.carousel');
var slides = carousel.find(".item").length;
carousel.carousel({ interval: 1000 });
var slowDown = function() {
var options = carousel.data()['bs.carousel'].options;
options.interval = options.interval * 2;
carousel.data({ options: options });
console.log(options.interval);
}
carousel.on('slide.bs.carousel', function () {
var slideFrom = $(this).find('.active').index() + 1;
if (slideFrom === slides) {
slowDown();
}
});
Upvotes: 1