PageSourceSearch

https://www.lsc-erftland.de/themes/custom/lsc_new/js/faq-accordion.js?tk0jqt

js lsc-erftland.de collected 2026-10-06 02:25:53 UTC 2,484 bytes, 70 lines download raw bytes

1/**
2 * FAQ Accordion - Custom Toggle Behavior mit Slide Animation
3 * Ermöglicht unabhängiges Öffnen und Schließen von FAQ Items
4 */
5(function (Drupal) {
6  'use strict';
7
8  Drupal.behaviors.faqAccordion = {
9    attach: function (context, settings) {
10      // Alle Accordion-Buttons einmal verarbeiten
11      const buttons = context.querySelectorAll('.faq-section .accordion-button');
12      
13      buttons.forEach(button => {
14        // Event-Listener nur einmal hinzufügen
15        if (!button.hasAttribute('data-faq-processed')) {
16          button.setAttribute('data-faq-processed', 'true');
17          
18          button.addEventListener('click', function(e) {
19            e.preventDefault();
20            
21            const targetId = this.getAttribute('data-bs-target');
22            const targetElement = document.querySelector(targetId);
23            
24            if (!targetElement) return;
25            
26            const isExpanded = this.getAttribute('aria-expanded') === 'true';
27            
28            if (isExpanded) {
29              // Schließen mit Slide-Animation
30              this.classList.add('collapsed');
31              this.setAttribute('aria-expanded', 'false');
32              
33              // Erst die aktuelle Höhe setzen
34              targetElement.style.height = targetElement.scrollHeight + 'px';
35              
36              // Dann auf 0 animieren
37              setTimeout(() => {
38                targetElement.style.height = '0';
39              }, 10);
40              
41              // Nach der Animation "show" entfernen
42              setTimeout(() => {
43                targetElement.classList.remove('show');
44              }, 350);
45              
46            } else {
47              // Öffnen mit Slide-Animation
48              this.classList.remove('collapsed');
49              this.setAttribute('aria-expanded', 'true');
50              
51              // Erst Höhe auf 0 setzen
52              targetElement.style.height = '0';
53              targetElement.classList.add('show');
54              
55              // Dann auf scrollHeight animieren
56              setTimeout(() => {
57                targetElement.style.height = targetElement.scrollHeight + 'px';
58              }, 10);
59              
60              // Nach der Animation height auf auto setzen für responsive Verhalten
61              setTimeout(() => {
62                targetElement.style.height = 'auto';
63              }, 350);
64            }
65          });
66        }
67      });
68    }
69  };
70})(Drupal);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.