How to add js to sub-menu faction for CSS styling
-
HI,
I am trying to figure out how I can style the sub-menu to stay up when the parent li is clicked (not only hovered). I have found a solution with JS which uses below code:<script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> var $j = jQuery.noConflict(); $j(document).ready(function() { }); function Reveal(a){ var ul = a.parentNode.getElementsByTagName("UL").item(0); $j(ul).animate({height: 'toggle' ,opacity: 'toggle'}, "slow"); } </script>
But I also have to add this code to the sub-menu li:
<li onclick="Reveal(this);"><a href="#">testimonials</a>
The question is I don’t know how to add
onclick="Reveal(this);
to the li.
Does anybody know how to add this functionality please?Thanks,
Helen
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to add js to sub-menu faction for CSS styling’ is closed to new replies.