i have this code that works nicely as you can see here.
here is the code:
How can i have this effect take place on 'mouse click' instead of 'mouse hover'?
I tried to edit code in many ways but can't figure out the solution.
thanks in advance
here is the code:
Code:
<div class='menu'>
<a href='#'><div class='cat'>title1</div></a>
<div class='sub_menu'>item1</div>
</div><div class='menu'>
<a href='#'><div class='cat'>title2</div></a>
<div class='sub_menu'>item2</div>
</div>
<script>
$(".cat").hover(function(){
$(this).parent().parent().find(".sub_menu").hide();
},
function() {
$(this).parent().parent().find(".sub_menu").show();
});
</script>
How can i have this effect take place on 'mouse click' instead of 'mouse hover'?
I tried to edit code in many ways but can't figure out the solution.
thanks in advance
Comment