Get 2024 Templates Mega Bundle!19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets
Get for 99$

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
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • 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
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(