Thursday, June 4, 2009

[jQuery] Re: UL Hover menu

You must to check if the moue moved on its childrens or not, before you trigger the close action.
Btw, IE sux.

2009/6/4 TJ <thomas@atalanta.uk.com>

Hi there,

I'm trying to create a hover dropdown many with jQuery and all seems
to work fine in safari but not in ie7?

The idea is that when I hover over the main li the sub ul appears and
slides down. When I hover over the main li is works as planned but
then on ie7 when I move the mouse down to the sub ul is slide back
up???

jQuery:

<script type="text/javascript">
       $(document).ready(function() {
               // hide sub menus
               $('ul.col_one_subnav').hide();
               // toggle sub menus on hover
               $('.col_one_navigation li').toggle(function() {
                       $(this).children('ul:hidden').slideDown();
                       }, function() {
                       $(this).children('ul:visible').slideUp();
               });
       });
</script>



HTML:

<ul class="col_one_navigation">
                       <li><a href="" title="">Blackboard</a>
                               <ul class="col_one_subnav">
                               <li><a href="" title="">Blackboard</a></
li>
                               <li><a href="" title="">Blackboard</
a></li>
                               <li><a href="" title="">Blackboard</
a></li>
                           </ul>
                       </li>
                       <li><a href="" title="">Placements</a></li>
                       <li><a href="" title="">Student Union</a></li>
                   </ul>

Can anyone help.

Thanks.

TJ



--
Gustavo Salome Silva

No comments: