In my LMS site , I have an accordion course sidebar with

Hi,

In my LMS site , I have an accordion course sidebar with multiple sections or modules and each section has multiple units or lessons inside it.

I have managed to make the first section expand as default and make the other section collapsed.However, once I finish the lessons on Section 1 and go onto Section 2, the Section 1 does not collapse and expand Section 2.It should do the same for subsequent sections.

I am attaching a screenshot of my course accordion sidebar as well as custom.css and custom.js files and I am hoping if you can guide me to get this accordion functionality working.

Thanks