Skip to content

Commit

Permalink
DDBPRO-159
Browse files Browse the repository at this point in the history
  • Loading branch information
mbuechner committed Nov 7, 2024
1 parent df8a34a commit de1ef8d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions web/themes/custom/ddbp/src/js/elements/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,17 @@ const closeAccordion = (accordion) => {
};

const toggleAccordion = (accordion, open) => {
const isOpen = open ? open : accordion.classList.contains(accordionOpenClass);

!isOpen ? openAccordion(accordion) : closeAccordion(accordion);
const isOpen = accordion.classList.contains(accordionOpenClass);

if(open === undefined && !isOpen) {
openAccordion(accordion);
} else if(open === undefined && isOpen) {
closeAccordion(accordion);
} else if(!open && !isOpen) {
openAccordion(accordion);
} else if(open && isOpen) {
closeAccordion(accordion);
}
};

const toggleAll = (event) => {
Expand Down

0 comments on commit de1ef8d

Please sign in to comment.