mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-17 19:21:23 +03:00
Docs: update documentation js examples, using es6 (#36203)
* Docs: update components documentation using es6 * Docs: update js blocks around docs, using es6 * Docs: update components documentation using es6 * Test linter
This commit is contained in:
@@ -302,8 +302,7 @@ The `data-bs-ride="carousel"` attribute is used to mark a carousel as animating
|
||||
Call carousel manually with:
|
||||
|
||||
```js
|
||||
var myCarousel = document.querySelector('#myCarousel')
|
||||
var carousel = new bootstrap.Carousel(myCarousel)
|
||||
const carousel = new bootstrap.Carousel('#myCarousel')
|
||||
```
|
||||
|
||||
### Options
|
||||
@@ -332,8 +331,8 @@ var carousel = new bootstrap.Carousel(myCarousel)
|
||||
You can create a carousel instance with the carousel constructor, for example, to initialize with additional options and start cycling through items:
|
||||
|
||||
```js
|
||||
var myCarousel = document.querySelector('#myCarousel')
|
||||
var carousel = new bootstrap.Carousel(myCarousel, {
|
||||
const myCarouselElement = document.querySelector('#myCarousel')
|
||||
const carousel = new bootstrap.Carousel(myCarouselElement, {
|
||||
interval: 2000,
|
||||
wrap: false
|
||||
})
|
||||
@@ -372,9 +371,9 @@ All carousel events are fired at the carousel itself (i.e. at the `<div class="c
|
||||
{{< /bs-table >}}
|
||||
|
||||
```js
|
||||
var myCarousel = document.getElementById('myCarousel')
|
||||
const myCarousel = document.getElementById('myCarousel')
|
||||
|
||||
myCarousel.addEventListener('slide.bs.carousel', function () {
|
||||
myCarousel.addEventListener('slide.bs.carousel', event => {
|
||||
// do something...
|
||||
})
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user