Skip to content

[docs] Carousel to API incorrect (v4) #41650

@mryellow

Description

@mryellow

Prerequisites

Describe the issue

.carousel('to')
Cycles the carousel to a particular frame (0 based, similar to an array). Returns to the caller before the next item has been shown (i.e. before the slid.bs.carousel event occurs).

https://getbootstrap.com/docs/4.6/components/carousel/#carouselto

It's difficult to determine what is meant by this. Probably one of the more obvious assumptions might be that the API is .carousel('to', 0).

Then this page shows (incorrect) examples:

$('#myCarousel').carousel('1')

https://getbootstrap.com/docs/4.6/getting-started/javascript/#asynchronous-functions-and-transitions

This will result in unknown method errors.

...

Instead the undocumented approach of $('#myCarousel').carousel(1) must be used. Somehow Google search AI summary knew about this.

When recognising a number being passed it will jump to that frame.

Reduced test cases

$('#myCarousel').carousel('to', 1)
$('#myCarousel').carousel('1')

What operating system(s) are you seeing the problem on?

Linux

What browser(s) are you seeing the problem on?

Chrome

What version of Bootstrap are you using?

4.6 website documentation

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions