Feature Req: Nesting Toggles, Nesting Accordions, Specify Open/Closed on Load?
-
So, I want to create a nested situation where I have one toggle show/hide sub-toggles. Or, likewise, have one accordion hide another accordion.
For instance:
[toggle heading=”H1″ title=”Essential Guide to the Electric Universe”]
[toggle heading=”H2″ title=”Preface”]Text[/toggle]
[toggle heading=”H2″ title=”Introduction”]Text[/toggle]
[/toggle]
This doesn’t appear to work correctly, as-is.
There is a single gray box However, rather than a single white toggle “Essential Guide…” with two child toggles, there are two toggles in the gray box. “Essential Guide” and “Introduction.” “Introduction” toggles properly with “Text” inside it. However, I’d think that it should be hidden within “Essential Guide” and only displayed with the primary toggle is toggled open. When one toggles “Essential Guide…” it open to reveal “Preface” and the word “Text” below the “Preface” toggle, not inside it. When you toggle “Preface” there is nothing “inside” it.
If we could make nesting work, this would potentially be a rather useful plugin. I think a similar situation exists for the Accordion shortcode as well. It would be nice if one could nest accordions as well… Though for my purposes, Toggle would probably be the more correct choice as accordion seems to always need to have one sub-text open, whereas Toggle, I think, doesn’t, thus one could collapse all the toggles.
While we’re at it, if we could have some kind of a switch in the shortcode to specify whether a given toggle is “open or closed” upon page load (default to ‘closed,’ if unspecified, or give an option in the settings as to how to handle unspecified open/closed state by default), that would be cool too. And in handling the open/closed initial state on load, it would be nice if higher level toggle shortcodes were honored. That is, if we have something like:
[toggle state=”closed” title=”Closed Parent”]
[toggle StartState=”open” title=”Child 1 Open”]Text[/toggle]
[toggle StartState=”closed” title=”Child 2 Closed”]Text[/toggle][/toggle]
The child 1 should be “open” but hidden inside the closed parent. That is, once the parent is opened we see child 2 is closed & child 1 is open already. But, we don’t see that until we toggle to open the Parent.
Make sense? Is that possible? I think that would make this pretty useful for things like FAQs or for displaying chapters/subsections of “books”/”papers” in a collapsible format, etc.?
- The topic ‘Feature Req: Nesting Toggles, Nesting Accordions, Specify Open/Closed on Load?’ is closed to new replies.