FAQ Accordion问题:点击ORDER分类时如何关闭Account分类
Solution: Disable Multiple Collapsible Mode
The core issue here is your accordion is set to allow multiple panels to stay open at the same time (multipleCollapsible: true). To make clicking the ORDER category automatically close the MYACCOUNT category, you just need to adjust this configuration.
Step-by-Step Fix
- Find the accordion initialization line in your code:
<div id="element" data-mage-init='{"accordion":{"openedState": "active", "collapsible": true, "active":[0], "multipleCollapsible": true}}'> - Change the
multipleCollapsiblevalue fromtruetofalse:<div id="element" data-mage-init='{"accordion":{"openedState": "active", "collapsible": true, "active":[0], "multipleCollapsible": false}}'>
Why This Works
- When
multipleCollapsibleisfalse, the accordion enforces a single open panel rule. Clicking any collapsed panel (like ORDER) will expand it and immediately close any other open panels (like MYACCOUNT). - The
collapsible: truesetting still lets you close the currently open panel by clicking its trigger if you want to collapse all sections.
Quick Additional Note
The active: [0] setting makes the first category in your $collectionTitle load as open. If MYACCOUNT is the first item in that collection, that’s why it’s expanded initially. To change which category starts open, adjust the index in the active array (e.g., active: [1] for the second category).
内容的提问来源于stack exchange,提问作者Mahi M
相关产品推荐
相关产品推荐

