I have built a sidebar navigation that collapses & expands when the nav titles are clicked. this all works great. however, if i expand / open one of the nav groups and click to go to a page, when the new page loads all the nav groups start out closed again. I would love to find a way for the active nav group to stay open.
Here is what I've used for the collapse / expand: (it's currently set up so that only one of the nav groups will be open at a time)
/* Collapse and Expand */
$(".slideTitle").click(function() {
$(".indexListOpen").removeClass("indexListOpen").addClass("indexList");
$(this).next().toggleClass("indexList").toggleClass("indexListOpen");
});
And this is what I was trying to use to keep the current nav group open when the new page loads:
/* keep current nav group open */
var path = location.pathname;
$('.indexListOpen a[@href$="' + path + '"]').addClass("selected");
$(".selected").parent().parent().removeClass("indexList").addClass("indexListOpen");
Not working ... so I'm sure I'm doing plenty wrong. The page I am working on is located at instarservices.com/commercial
Any help is appreciated!!!