Hi Team,
I’m Darshan Hiranandani, working on a feature where I want to toggle an accordion by clicking on an external button. Here’s the situation:
- Current Approach: I’ve tried using
brx-open
directly, but it only works until the accordion’s built-in toggle is interacted with, after which the external button stops functioning. Additionally, this method doesn’t play the accordion opening animation controlled by Bricks. - Issue with JS Click Function: The JavaScript click function I’ve tried doesn’t seem to work for toggling the accordion.
Given these issues, I’m looking for a proper approach to achieve this functionality. Could anyone provide suggestions or guidance on the following?
- External Button Toggle: What’s the best way to toggle an accordion using an external button while maintaining the animation?
- JavaScript Approach: How can I properly use JavaScript to control the open/close state of an accordion with external buttons?
- Integrating with Bricks: How can I ensure that the accordion’s animation and behavior are correctly triggered by external buttons?
- Event Handling: What is the recommended method for handling events to toggle the accordion from an external button?
- Alternative Methods: Are there alternative methods or best practices for achieving external button control over an accordion?
Your insights or suggestions on resolving this issue would be greatly appreciated!
Thanks,
Darshan Hiranandani