Opening parents of a nested navigator
I have a code for a navigator which I that works like an accordion.
A picture to demonstrate my navigator:
Ignore the "wierd characters", this is my language.
this is a code example of how it build: http://jsfiddle.net/uXA7E/3/
As you can see, the navigator is max 3 levels depth.
What I'm trying to achieve is that if the user is browsing category with
the id of "13" or so with jQuery I will pick the element with the class of
13, and then reveal all the way down to it and mark it in some color.
this is how a link build:
<a class="13" href="category.php?cid=13">áìå÷éí åãôãôåú</a>
I do have an element on the page that holds the ID that im viewing:
<input type="hidden" value="13" id="cid">
This is the code that I tried:
var until = document.getElementsByClassName('depth-two');
$("."+$("#cid").val()).prevUntil(until,"ul").show();
AND:
$("."+$("#cid").val()).prevAll("ul").show();
Unfortunately, it didn't work at all.
Any other ideas?
No comments:
Post a Comment