Jquery HELP!!
Jquery HELP!!
Out of context: Reply #14
- Started
- Last post
- 16 Responses
- iamaracinghorse0
I would put the nav items in an unordered list, then put the dropdown in an unordered list nested under the dropdown header li element, like so:
<ul id="nav">
<li>first
<ul class="dropdown" style="display:none">
<li>sub-first</li>
<li>sub-second</li>
<li>sub-third</li>
</ul>
</li>
<li>second</li>
<li>third</li>
</ul>Then put a click function and a hover function on the header li element that will show and hide any ul elements inside the header li element, like so:
$('ul#nav li').click(
function(){$('ul.dropdown', this).slideDown()}).hover(null,f...
$('ul.dropdown', this).slideUp();
});I've tried this approach and it worked fine. Does it make sense??