I have setup the FAQs on my site to have categories and sub categories. I am using the setting "Clicking on category opens/hides questions and answers under category". When I click on the parent category it opens exposing the sub categories, but when I click the sub categories it closes the parent category. I believe the problem stems from the fact that the JS closes all open categories when a new one is opened. It seems to be ignorant of parent/child categories. I have modified the JS to compensate for this and now it works. The patch will be added in the first comment. Also the JS could use a bit of tweaking. For instance if you use a declaration more than once in jQuery you should save it to a variable so that the browser only does one DOM lookup.
var $this = $(this);
$this.next();
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | faq-7.x-1.x-dev-1715292-3.patch | 2.02 KB | grimbones |
Comments
Comment #1
grimbones commentedHere is the patch to the JS.
Comment #2
grimbones commentedupdating status
Comment #3
grimbones commentedI realized that my original patch fixes the sub category problem for a two layer system, but any more layers and it does not work.
This means that this works:
Category 1
-Sub-category 2
This does not:
Category 1
-Sub-category 2
--Sub-category 3
The new patch I am attaching should solve this problem. Basically the fix was that add a class of collapsed to all div.faq-qa-hide except the current and any one that has the current one as a child.
Comment #4
sanchiz commentedComment #6
podarokCommited, thanks!