I have a simple ul and need to be able to navigate up and down the different li, using a up and down button. That way when the up button is clicked and will select each li, until it gets to the top of the ul and then you can press the down button to navigate back down, selecting the next li, each time the button is clicked.
Not sure how to go about this…
<div id="MainMenu">
<ul>
<li><a href="#">PATIENT TEST</a></li>
<li><a href="#">QC TEST</a></li>
<li><a href="#">REVIEW RESULTS</a></li>
<li><a href="#">OTHER</a></li>
</ul>
</div>
I’m using the following jQuery code to switch the class for the active li…
$("li:not(.active)").live("click", function() {
$(this).addClass("menuActive");
$(this).siblings().removeClass("menuActive");
});
Probably something like this:
Demo http://jsfiddle.net/Us4q9/3/
Or using keyboard navigation: