PDA

View Full Version : Accordian script help; Count reset and / or multiple header classes



Hebgbs
07-15-2018, 05:25 PM
Accordion Content Script (v2.0)
http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm

I am writing content which very heavily uses this script's capabilities to selectively reveal things but since I am ever so green with LiveScript / JavaScript I could get it off the ground with a functional example but encountered difficulties in its use with multiple subheadings.

It's not that it doesn't work, the content functions as intended and works identically to the examples provided except when writing multiple nested content, the nested sections never reset their count so where as the user would see , for example a page with two main sections and three nested sections in each, to define a URL which opens the second subsection in the second section it would actually be the fifth subsection in the second section as the count of nested sections underneath another main section doesn't reset.

As such, instead of a url ending in say,
?heading=2&subheading=2, it is rendered as
?heading=2&subheading=5 which is infuriatingly confusing when there is a clear disconnect between the content shown and how to access it. This gets especially hairy in my case where I have multiple nested menus to deal with, making me have to denote in my code what the sections actually are to the script versus what the end-user sees.

So now I wonder, is there a way to reset the count when a nested section ends? Further, if that isn't possible or if I wanted to use the same attributes but attach different names to them is there a way for multiple
headerclass entities without needing to initialize for every single header class, which would massively clutter up my JS?