BrightLeaf Digital Code Snippet Library
Check out our growing library of code snippets for Gravity Forms!
Eleven of these snippets register their own shortcodes. Every tag and attribute is in our Gravity Forms shortcodes reference. Need a Gravity Forms or GravityView shortcode built for you? Try the free shortcode builder.
Mobile Accordion Shortcode
Goal
Creates a mobile-friendly accordion component that parses nested divs into collapsible sections. Supports nested shortcodes and allows only one section to be open at a time. CONFIGURATION
- CSS: Add styles for .mobile-accordion-wrapper, .accordion-section, .accordion-label, .accordion-content
- CSS: Define .open and .visible classes for active states
- Structure: Content must follow specific format (see usage below)
Usage
[mobile_accordion] <div> <div>Section 1 Title</div> <div>Section 1 content goes here...</div> </div> <div> <div>Section 2 Title</div> <div>Section 2 content goes here...</div> </div> [/mobile_accordion]
Notes
- First section opens by default
- Supports nested shortcodes
This code is best installed directly on your site using the Code Snippets plugin.
Loading...
Review this entry
You must be logged in to post a comment.