Keep collapsible menu open


I’m fairly new to Grav and I need some help.
For a sidemenu I wanted to list all titles from the childpages of a certain parent with a collapsible menu.

In the cookbook I found exactly what I need.

I also changed this line:
{% for page in pages.children.visible %} with {% for page in page.find('/path/page').children %} to only show me the children from the current parent. (Tell me, if there is a better way.)

Now my problem is:
How i get it to work that the menu stays open?

Thanks in advance


sadly i don’t found a solution for my problem.

To clarify my question:

I got this code from the cookbook, which creates a menu with my pages and their subpages.

My problem is when i’m on a subpage the menu is closed. How can i prevent that the menu is closing with every page load.

I hope you guys understand.

Maybe its better to ask on stackoverflow or similar but i will give it another try here.