help with images on an accordion menu
Hi,
I have created an accordion menu. It works great. I thought it would be neat to put a down arror on the "current" or "open" menu selection and have the other menu selections have a right error. I have added the image tags as a child of "dt a". But it has not been as easy as I thought.
Here is my code: Which works for all menu selections except the first selection. I think if I knew how to say for the current selected menu item put the down arror on me. And put the right arrow on the other menu selections.
The code below, is a hack it says to put a right arrow on all. Then put a down arrow on the children, which seems backward.
Because the result is to have a down arrow on the clicked menu selection (except for the first menu item, which remains a right item). And the rest of the menu selections have a right arrow.
-
$("dt a").click(function(){
$("dd:visible").slideUp("slow");
$(this).parent().next().slideDown("slow");
$("img").attr("src", "images/16-arrow-right.png")
$(this).children("img").attr("src", "images/16-arrow-down.png");
return false;
});