mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-20 20:00:36 +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:
@@ -271,10 +271,8 @@ While both ways to dismiss an offcanvas are supported, keep in mind that dismiss
|
||||
Enable manually with:
|
||||
|
||||
```js
|
||||
var offcanvasElementList = Array.prototype.slice.call(document.querySelectorAll('.offcanvas'))
|
||||
var offcanvasList = offcanvasElementList.map(function (offcanvasEl) {
|
||||
return new bootstrap.Offcanvas(offcanvasEl)
|
||||
})
|
||||
const offcanvasElementList = document.querySelectorAll('.offcanvas')
|
||||
const offcanvasList = [...offcanvasElementList].map(offcanvasEl => new bootstrap.Offcanvas(offcanvasEl))
|
||||
```
|
||||
|
||||
### Options
|
||||
@@ -302,8 +300,7 @@ Activates your content as an offcanvas element. Accepts an optional options `obj
|
||||
You can create an offcanvas instance with the constructor, for example:
|
||||
|
||||
```js
|
||||
var myOffcanvas = document.getElementById('myOffcanvas')
|
||||
var bsOffcanvas = new bootstrap.Offcanvas(myOffcanvas)
|
||||
const bsOffcanvas = new bootstrap.Offcanvas('#myOffcanvas')
|
||||
```
|
||||
|
||||
{{< bs-table "table" >}}
|
||||
@@ -331,8 +328,8 @@ Bootstrap's offcanvas class exposes a few events for hooking into offcanvas func
|
||||
{{< /bs-table >}}
|
||||
|
||||
```js
|
||||
var myOffcanvas = document.getElementById('myOffcanvas')
|
||||
myOffcanvas.addEventListener('hidden.bs.offcanvas', function () {
|
||||
const myOffcanvas = document.getElementById('myOffcanvas')
|
||||
myOffcanvas.addEventListener('hidden.bs.offcanvas', event => {
|
||||
// do something...
|
||||
})
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user