1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-10-03 00:31:55 +02:00

Docs: Add transparency option

This commit is contained in:
Louis-Maxime Piton
2024-09-02 17:26:37 +02:00
parent e3e00b5002
commit ae8c43a9c6
4 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
// IT'S ALL JUST JUNK FOR OUR DOCS!
// ++++++++++++++++++++++++++++++++++++++++++
/*!
* JavaScript for Bootstrap's docs (https://getbootstrap.com/)
* Copyright 2024 The Bootstrap Authors
* Licensed under the Creative Commons Attribution 3.0 Unported License.
* For details, see https://creativecommons.org/licenses/by/3.0/.
*/
(() => {
const transparencyToggler = document.querySelector('.transparency-toggle')
const examplesContainer = document.querySelector('.bd-content')
transparencyToggler.addEventListener('click', () => {
const altText = `Toggle examples' transparency (${examplesContainer.classList.contains('transparency') ? 'inactive' : 'active'})`
transparencyToggler.title = altText
transparencyToggler.querySelector('span.d-lg-none').textContent = altText
transparencyToggler.setAttribute('aria-label', altText)
examplesContainer.classList.toggle('transparency')
})
})()