A Cool Accordion
You could simply toggle the .show class (if display: block is uncommented in the CSS) in JavaScript, but you'll lose the animation.
- Item 1
- Option 1
- Option 2
- Option 3
- Item 2
- Option 1
- Option 2
- Option 3
- Item 3
- Open Inner
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas tempus placerat fringilla. Duis a elit et dolor laoreet volutpat. Aliquam ultrices mauris id mattis imperdiet. Aenean cursus ultrices justo et varius. Suspendisse aliquam orci id dui dapibus blandit. In hac habitasse platea dictumst. Sed risus velit, pellentesque eu enim ac, ultricies pretium felis.
- Open Inner #2
Children will automatically close upon closing its parent.
- Option 3
- Open Inner
- Item 4
- Technically any number of nested elements
- Another nested element
As long as the inner element has inner as one of its classes then it will be toggled.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas tempus placerat fringilla. Duis a elit et dolor laoreet volutpat. Aliquam ultrices mauris id mattis imperdiet. Aenean cursus ultrices justo et varius. Suspendisse aliquam orci id dui dapibus blandit. In hac habitasse platea dictumst. Sed risus velit, pellentesque eu enim ac, ultricies pretium felis.
- Another nested element
- Option 2
- Option 3
- Technically any number of nested elements