tags:

views:

388

answers:

1

I have a menu (vertical menu) and i want each of the Ul's to show when hovering the dd's, and hide back in when mouseOut (second function of .hover()) what will be the best easiest way (without a plugin).

<dl class="lft-menubar">
<dt>Computers</dt>
    <dd>
      <ul class="slidedMenu">
         <li>3rd level menu</li>
         <li>3rd level menu</li>
         <li>3rd level menu</li>
         <li>3rd level menu</li>
         <li>3rd level menu</li>
         <li>3rd level menu</li>         
      </ul>
    </dd>

Thanks

+1  A: 
<script type="text/javascript">
$("dl.lft-menubar dd").hover(function() {
$(this).next().show();
},function() {
$(this).next().hide();
});
</script>

Try something like that. :)

Salty
Thanks, but the code below is more correct (according to the example HTML) $("dd").hover( function (){ $(this).children("ul").show(); return false }, function (){ $(this).children("ul").hide() });
adardesign
My mistake. I was looking at the relationship between the <dt> and the <dd> for some reason. Glad you figured it out though :)
Salty
by the way, how do i add the event as an parameter? with the (e) in both functions? $("dd").hover( function (e){ $(this).children("ul").show(); return false }, function (e){ $(this).children("ul").hide() })
adardesign
I believe that's correct. :)
Salty