Need collection filtering accordion header to stay open if one item is selected from it

Solved
New Member
10 0 0

Hello! This is my first post in the Shopify community forum, though I have been using it for years. I am working on a store using the Pipeline theme and I just finished adding accordion headers that open and close to my client's collection filtering. The way the collection filtering works now is that once you select a filter from under one of the main headers, the page reloads and the main accordion header that contains the filter you selected does not stay open. Therefor, it's difficult for the user to tell which filters they have selected. I want to know if there's a way to add some code so that those headers stay open if an item below has been selected for filtering. The site I'm working on is https://triedequestrian.com. Any and all help/suggestions are welcome. Thank you!

0 Likes
Highlighted

Success.

Shopify Partner
2522 25 504

While it's possible to do in liquid, one needs to see the source code of the theme for this.

However, you can use Javascript too -- put this code at the very bottom of theme.js

$( function(){ $('.sidebar__item--active').parent().prev().click(); } );
Want to hire me to tweak a theme? Mail me at tairli@yahoo.com! My post solved your problem? This is my Paypal too :)
0 Likes
New Member
10 0 0

Awesome, this worked perfectly. Thank you!

0 Likes