diff options
Diffstat (limited to 'site/content/docs/5.1/examples/cheatsheet/cheatsheet.js')
-rw-r--r-- | site/content/docs/5.1/examples/cheatsheet/cheatsheet.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js b/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js index 0a50258b92..e25a89e75d 100644 --- a/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js +++ b/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js @@ -1,24 +1,24 @@ /* global bootstrap: false */ -(function () { +(() => { 'use strict' // Tooltip and popover demos document.querySelectorAll('.tooltip-demo') - .forEach(function (tooltip) { + .forEach(tooltip => { new bootstrap.Tooltip(tooltip, { selector: '[data-bs-toggle="tooltip"]' }) }) document.querySelectorAll('[data-bs-toggle="popover"]') - .forEach(function (popover) { + .forEach(popover => { new bootstrap.Popover(popover) }) document.querySelectorAll('.toast') - .forEach(function (toastNode) { - var toast = new bootstrap.Toast(toastNode, { + .forEach(toastNode => { + const toast = new bootstrap.Toast(toastNode, { autohide: false }) @@ -27,27 +27,27 @@ // Disable empty links and submit buttons document.querySelectorAll('[href="#"], [type="submit"]') - .forEach(function (link) { - link.addEventListener('click', function (event) { + .forEach(link => { + link.addEventListener('click', event => { event.preventDefault() }) }) function setActiveItem() { - var hash = window.location.hash + const { hash } = window.location if (hash === '') { return } - var link = document.querySelector('.bd-aside a[href="' + hash + '"]') + const link = document.querySelector(`.bd-aside a[href="${hash}"]`) if (!link) { return } - var active = document.querySelector('.bd-aside .active') - var parent = link.parentNode.parentNode.previousElementSibling + const active = document.querySelector('.bd-aside .active') + const parent = link.parentNode.parentNode.previousElementSibling link.classList.add('active') @@ -59,7 +59,7 @@ return } - var expanded = active.parentNode.parentNode.previousElementSibling + const expanded = active.parentNode.parentNode.previousElementSibling active.classList.remove('active') |