Theo/common.js: Unterschied zwischen den Versionen
Aus exmediawiki
Theo (Diskussion | Beiträge) Die Seite wurde neu angelegt: „<script> document.addEventListener('DOMContentLoaded', function() { // Get all toggle buttons const toggleButtons = document.querySelectorAll('.toggle-butt…“ |
(kein Unterschied)
|
Version vom 26. Mai 2025, 13:33 Uhr
<script>
document.addEventListener('DOMContentLoaded', function() {
// Get all toggle buttons
const toggleButtons = document.querySelectorAll('.toggle-button');
const contentSections = document.querySelectorAll('.content-section');
let currentlyOpen = null;
toggleButtons.forEach(function(button) {
button.addEventListener('click', function() {
const targetId = this.getAttribute('data-target');
const targetContent = document.getElementById(targetId);
// If clicking the same button that's already open, close it
if (currentlyOpen === targetId) {
targetContent.style.display = 'none';
currentlyOpen = null;
return;
}
// Hide all content sections
contentSections.forEach(function(section) {
section.style.display = 'none';
});
// Show the target content
targetContent.style.display = 'block';
currentlyOpen = targetId;
});
});
});
</script>