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();

Comments

grimbones’s picture

StatusFileSize
new1.96 KB

Here is the patch to the JS.

grimbones’s picture

Status: Active » Needs review

updating status

grimbones’s picture

StatusFileSize
new2.02 KB

I 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.

sanchiz’s picture

Assigned: Unassigned » sanchiz
Issue summary: View changes

  • podarok committed 4b2b639 on 7.x-1.x authored by grimbones
    Issue #1715292 by grimbones: Fixed Sub Category clicks close parent...
podarok’s picture

Assigned: sanchiz » Unassigned
Status: Needs review » Fixed

Commited, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.