I have two different carousels on my site; 1 that auto-slides, and 1 that doesn't. For the one that doesn't I'm using custom js to create pagination.
The problem is, that on the second one mentioned above, I removed the "slide" class but it's still auto-sliding.
Since I have the other carousel that does need to auto-slide, I can't change the bootstrap.js interval to false. (I also don't want to include a separate script on the page with the one I need to fix, because it's part of a site template and that gets messy).
Here is my jsFiddle with all the code. http://jsfiddle.net/cindyg/UNKeL/4/
You can see that the containing div does not have the "slide" class:
<div id="myCarousel" class="carousel">
I have seen people post about the opposite problem, such as Bootstrap Carousel Not Automatically Sliding and have applied some of the techniques mentioned, to no avail.
Here is the custom js I added to get the pagination:
$(document).ready(
function() {
$('#myCarousel').each(
function() {
var html = '<div class="carousel-nav " data-target="' + $(this).attr('id') + '"><ul>';
for(var i = 0; i < $(this).find('.item').size(); i ++) {
html += '<li><a';
if(i == 0) {
html += ' class="active"';
}
var item = $(this).find('.item').get(i);
html += ' href="#"> ' + $(item).attr('data-title') + '</a></li>';
}
html += '</ul></li>';
$(this).after(html);
$('.carousel-control.left[href="#' + $(this).attr('id') + '"]').hide();
}
).bind('slid',
function(e) {
var nav = $('.carousel-nav[data-target="' + $(this).attr('id') + '"] ul');
var index = $(this).find('.item.active').index();
var item = nav.find('li').get(index);
nav.find('li a.active').removeClass('active');
$(item).find('a').addClass('active');
if(index == 0) {
$('.carousel-control.left[href="#' + $(this).attr('id') + '"]').fadeOut();
} else {
$('.carousel-control.left[href="#' + $(this).attr('id') + '"]').fadeIn();
}
if(index == nav.find('li').size() - 1) {
$('.carousel-control.right[href="#' + $(this).attr('id') + '"]').fadeOut();
} else {
$('.carousel-control.right[href="#' + $(this).attr('id') + '"]').fadeIn();
}
}
);
$('.carousel-nav a').bind('click',
function(e) {
var index = $(this).parent().index();
var carousel = $('#' + $(this).closest('.carousel-nav').attr('data-target'));
carousel.carousel(index);
e.preventDefault();
}
);
$('.carousel').carousel('cycle'); // Start the animation automatically
});