Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Accordion active not working


Hello, when an accordion sub menu is active, the accordion menu closes again, it wont stay open. These are the active state code.

<a class="menu-link <?php if($page == '1') { echo 'active'; } ?>" href="?page=1">


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)


Hi,

Can you set here show classes to the menu item to keep the accordion open by default?


<div class="menu-item here show menu-accordion">
...
</div>


Regards.



Thank you for your answer, but I want it to be open when its active. Not always open. Please see demo1

How to make the menu open when submenu is active?



Hi,

You need to set here show classes to the submenu accordion's parent item.

Or please provide us more info if you are trying to achieve something else.

Regards.



I have set menu-accordion like this

<div data-kt-menu-trigger="click" class="menu-item here show menu-accordion">


And sub menu like this:


<div class="menu-sub menu-sub-accordion">


And still not working



Hi,

Can you please try to set data-kt-menu-expand="true" to keep the active accordions open always? You can also refer to Demo 1 Inner Page layouts submenu and active menu link classes.

Regarss.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(