forked from plume/documentation
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
854 B
JavaScript
24 lines
854 B
JavaScript
document.getElementById('menu').addEventListener('click', evt =>
|
|
evt.target.parentElement.classList.toggle('show')
|
|
)
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
for (const switcher of document.getElementsByClassName('language-switcher')) {
|
|
const control = switcher.querySelector('[aria-haspopup]');
|
|
control.addEventListener('click', event => {
|
|
const popupId = control.getAttribute('aria-controls');
|
|
if (! popupId) return;
|
|
const popup = document.getElementById(popupId);
|
|
if (! popup) return;
|
|
if (control.getAttribute('aria-expanded') === 'true') {
|
|
control.setAttribute('aria-expanded', 'false');
|
|
popup.setAttribute('aria-hidden', 'true');
|
|
} else {
|
|
control.setAttribute('aria-expanded', 'true');
|
|
popup.setAttribute('aria-hidden', 'false');
|
|
|
|
}
|
|
});
|
|
}
|
|
});
|