Chuck
Chuck

Reputation: 190

Bootstrap carousel advance on click

I've been trying to get the standard carousel in Bootstrap to advance every time you click a slide without using indicators or controls. Just wanted to ask if there's a way of getting it to work such way. This without using an onclick event on the page but rather using jQuery for navigation.

Upvotes: 1

Views: 2828

Answers (2)

Chuck
Chuck

Reputation: 190

$("#Mycarousel").carousel('next');

Now seems to work. Sorry I was using id's and am a newbie with jQuery so I had the same id on all slides and forgot it's the same page and it doesn't know "slides" or images or imgs or whatever :/

Upvotes: 1

void
void

Reputation: 36703

Say if carousel id is carousel

var number = 0;

$("#carousel img").click(function() {

  $("#carousel").carousel(++number);

});

Upvotes: 2

Related Questions