Hi there,
I have an image with a class of "actions_image" that when clicked shows a menu. This image with hidden menu appears several times on the same page. I'm having issues with the code below for 2 reasons:
1 - In the Javascript code, the first line is to ensure that if there's already a menu open, this will be closed before the new menu is shown. But when this line is added, then the second line with the toggle command no longer toggles. It only shows the div when you click, but won't hide it when you click again. All the rest of the actions work perfectly, as in the div hides when anything but the image that shows it is clicked
2 - IE 7 is throwing up an error for the 2nd line of javascript because of the use of :hover and won't show the menu at all (grrr...!)
Can anyone help?
Javascript code:
section_actions_menu: function(event){
$(".actions_image").next().hide();
$(".actions_image:hover").next().toggle();
$("body").click(function(e){
if(e.target.className !== "actions_image")
{
$(".actions_image").next().hide();
}
});
}
HTML Code:
<img src="/media/images/spacer.gif" width="31" height="18" alt="Section Actions Menu" title="Section Actions Menu" class="actions_image" onclick="section_actions_menu(event);"/>
<div class="toggle">
<ul>
<li><a title="Add">Add</a></li>
<li><a title="Edit">Edit</a></li>
<li><a title="Remove">Remove</a></li>
</ul>
</div>
Any help would be much appreciated.