Collapsible panels with a data file and some simple js

Demo: https://rdyar.github.io/collapsible-panels/

Repo: https://github.com/rdyar/collapsible-panels

On one of my sites I have FAQs in collapsible panels which was using some js from bootstrap along with jquery. It bugged me that it was so much overhead for something I thought should be simple so I managed to write my own js to do it and it seems to work pretty well (certainly open to constructive criticism though as I am only just learning js).

I think it is a good example of what to use a data file for - it is so much easier to abstract the content out from the code.

1 Like

Nice tutorial. Thanks for sharing.