Hello,
thanks in advance for any advice.
I'm quite new to this, learning html and css and trying to make a theme for grav that serves my purposes.
I'm using the w3.css framework because I've found their web site useful and they keep the vocabulary simple.
For my blog posts I want to display a headline that can be clicked on to show the first paragraph of the post so on arrival the blog is a list of headlines. Click one and it expands, click another and it expands.
I'm using this accordion feature of w3.css and I've put that code, slightly modified into my blog_item.html.twig file where I want to list the blog posts.
It's working, cosmetically, I can see the list of blog posts. When I click the top one it opens the accordion. When I click it again it closes. But when I click the next one it opens the top one again, and clicking it closes the top one.
To explain again, there are three blog posts: 1, 2, and 3. Clicking 1 opens the accordion for 1. Clicking 2 opens the accordion for 1. Clicking 3 opens the accordion for 1.
I'm assuming that this has something to do with the id that is used in the script - Demo1 - (see the w3c accordian page here) and that the process of listing the blog entries in blog.html.twig is repeatedly using the same id - Demo1.
Am I correct? Is there some way of applying a new id for each blog post so that this does not occur?
Or am I way off?
Thanks so much for any suggestions. bye
Adam