I am trying to create a custom accordion for my page to that display my posts. I have it in list format using HTML and I am trying to create an effect when you click each header to expand to show more information.
But I don’t want to have say six blocks of code for six of the <li> elements I have on the page.
Is there a way to run it through .each(); perhaps? Instead of creating each section? Try a more dynamic approach.
Did you take a look at this tutorial ?
Because, as this example illustrates, one does not need multiple conditions to achieve this.