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:
@@ -319,7 +319,7 @@ To easily add scrollspy behavior to your topbar navigation, add `data-bs-spy="sc
|
||||
### Via JavaScript
|
||||
|
||||
```js
|
||||
var scrollSpy = new bootstrap.ScrollSpy(document.body, {
|
||||
const scrollSpy = new bootstrap.ScrollSpy(document.body, {
|
||||
target: '#navbar-example'
|
||||
})
|
||||
```
|
||||
@@ -371,10 +371,9 @@ To keep backwards compatibility, we will continue to parse a given `offset` to `
|
||||
Here's an example using the refresh method:
|
||||
|
||||
```js
|
||||
var dataSpyList = Array.prototype.slice.call(document.querySelectorAll('[data-bs-spy="scroll"]'))
|
||||
dataSpyList.forEach(function (dataSpyEl) {
|
||||
bootstrap.ScrollSpy.getInstance(dataSpyEl)
|
||||
.refresh()
|
||||
const dataSpyList = document.querySelectorAll('[data-bs-spy="scroll"]')
|
||||
dataSpyList.forEach(dataSpyEl => {
|
||||
bootstrap.ScrollSpy.getInstance(dataSpyEl).refresh()
|
||||
})
|
||||
```
|
||||
|
||||
@@ -387,8 +386,8 @@ dataSpyList.forEach(function (dataSpyEl) {
|
||||
{{< /bs-table >}}
|
||||
|
||||
```js
|
||||
var firstScrollSpyEl = document.querySelector('[data-bs-spy="scroll"]')
|
||||
firstScrollSpyEl.addEventListener('activate.bs.scrollspy', function () {
|
||||
const firstScrollSpyEl = document.querySelector('[data-bs-spy="scroll"]')
|
||||
firstScrollSpyEl.addEventListener('activate.bs.scrollspy', () => {
|
||||
// do something...
|
||||
})
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user