You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using an accordion to clean up a large sidebar navigation menu. If a given nav item is selected, it's parent accordion item should be toggled open on page load. I'm currently doing this with a child controller here: import AccordionController from "@kanety/stimulus-accordion"; export default class extends AccordionController { static values = { guide: Number, }; connect() { const el = document.querySelector( `[data-accordion-id=content${this.guideValue}]` ); el.classList.add("st-accordion__content--visible"); } }
This works, but it's not perfect because the initial element will still contain "st-accordion__content--visible" even after another element is toggled. Can you recommend a cleaner approach to this? I think you are using binding observers, which I am not familiar with.
The text was updated successfully, but these errors were encountered:
I'm using an accordion to clean up a large sidebar navigation menu. If a given nav item is selected, it's parent accordion item should be toggled open on page load. I'm currently doing this with a child controller here:
import AccordionController from "@kanety/stimulus-accordion"; export default class extends AccordionController { static values = { guide: Number, }; connect() { const el = document.querySelector( `[data-accordion-id=content${this.guideValue}]` ); el.classList.add("st-accordion__content--visible"); } }
This works, but it's not perfect because the initial element will still contain
"st-accordion__content--visible"
even after another element is toggled. Can you recommend a cleaner approach to this? I think you are using binding observers, which I am not familiar with.The text was updated successfully, but these errors were encountered: