I'm using the jQuery Treeview plugin for navigation on a site with nested levels of categories. In each category there are then products, each of which have one or more information types.
So my URLs can be either:
- foo.com/view/cat_id/
- foo.com/view/cat_id/prod_id/
- foo.com/view/cat_id/prod_id/info_id/
Trouble is, the navigation for the products is separate to the categories, which means Treeview only 'knows about' (and therefore marks 'active') case 1. Cases 2 & 3 mean that the tree is collapsed, whereas I want the tree to be open to cat_id for all cases.
(I'm open to anything, but) I'm thinking the solution is some Javascript trickery to remove anything after cat_id/ from the URL so that I can then pass the result to Treeview, but not being that au fait with Javascript I can't figure out how to do it.
Note: I'm looking for help with the Javascript regex, not Treeview, though on the off-chance that anyone knows of a ready-rolled solution I am of course all ears.
TIA.