CSS Accordion (No JavaScript) : Works both on AMP and Non-AMP pages
These accordions require only CSS for functioning and work both on AMP and non-AMP pages without any JavaScript or AMP script. Each accordion is independent of other accordions on the page and you are required to give a unique id to each accordion.
Demo of CSS Accordion
I am content of Accordion 1.
I am content of Accordion 2.
I am content of Accordion 4.
I am content of Accordion 4.
I am content of Accordion 4.
I am content of Accordion 4.
I am content of Accordion 4.
I am content of Accordion 4.
I am content of Accordion 4.
I am content of Accordion 4.
I am content of Accordion 4.
Accordion Code
Accordion Type B : Requirement CSS and JQuery
Each accordion is independent of other accordions on the page.
Accordion and its container can be any HTML element.
The script inserts triangle on page load with direction as per the visibility of accordion content element set and also adds title attribute 'Click / Tap to Show / Hide Content'.
On click / tap on accordion, the script hides / shows its content and changes direction of triangle.
Demo of Accordion Type B
Accordion 1 (Content visible on page load)
I am content of Accordion 1. I was visible on page load.
Accordion 2 (Content hidden on page load)
I am content of Accordion 2. I was hidden on page load.
Accordion 3 (Content visible on page load)
I am content of Accordion 3.
Accordion Code
Accordion Type C : Requirement CSS and JQuery
On page load first accordion's content is visible and other accordions' content is hidden.
Accordion and its container can be any HTML element.
The script inserts triangle on page load with direction as per the visibility of accordion content element set and also adds title attribute 'Click / Tap to Show / Hide Content'..
If the content of accordion is visible, on click / tap on accordion the script hides its content and changes direction of triangle.
If the content of accordion is hidden, on click / tap on accordion the script makes its content visible and hides content of other accordion and changes direction of triangle of that accordion.
The content of only one accordion is visible at a time.