2
0
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:
GeoSot
2022-04-26 19:38:41 +03:00
committed by GitHub
parent 3edead4ffe
commit 00d45b11e7
21 changed files with 504 additions and 179 deletions
+5 -6
View File
@@ -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...
})
```