Frnk
Frnk

Reputation: 11

Bootstrap 4 Carousel next/prev buttons documentation

I have a Bootstrap 4.0.0 Carousel up and running. Time based changes and direct selection of items work as expected.

But the prev/next buttons do not work. Documentation says, it should be like this (example for the left/prev button):

<a class="carousel-control-prev" role="button" data-slide="prev" href="#carousel-id">
   <span class="carousel-control-prev-icon" aria-hidden="true"></span>
   <span class="sr-only">Previous</span>
</a>

But like that, it does not work. BUT, when I do it like that:

<a class="carousel-control-prev" role="button" data-slide="prev" data-target="#carousel-id">
   <span class="carousel-control-prev-icon" aria-hidden="true"></span>
   <span class="sr-only">Previous</span>
</a>

Here, when I swapped out href with data-target it works. Why does everyone say, it should be href? Can I use data-target then? data-target is used also by 'data-slide-to' button, why not with 'data-slide'? This makes no sense.

Upvotes: 1

Views: 101

Answers (1)

Frnk
Frnk

Reputation: 11

Ok, I had Bootstrap 4.0.0 and jQuery 2.5.x. I upgraded to jQuery 3.5.1, now it works as expected.

Upvotes: 0

Related Questions