我无法让子菜单的其余部分正常显示

问题描述:

我有一个带ul子菜单的菜单,我写的脚本只能显示第一个子菜单,而另一个不显示。我无法让子菜单的其余部分正常显示

这是jQuery脚本我使用

$(document).ready(function(){ 
    $('#top_menu_blockx').hover(
     function(){ 
      $('#top_menu_blockx').children('ul').stop().fadeIn('slow'); 
     }, 
     function(){ 
      $('#top_menu_blockx').children('ul').stop().fadeOut('slow'); 
     } 
    ); 
}); 

我已经包含了链接托特他的jsfiddle。 http://jsfiddle.net/kakashi807/RrYs4/2/

btw,为什么当鼠标悬停时子菜单的字体颜色不会变成白色?

谢谢

试试这个 - DEMO

$(document).ready(function(){ 
    $('.top_menu_btnx').hover(
     function(){ 
      $(this).children('ul').stop().fadeIn('slow'); 
     }, 
     function(){ 
      $(this).children('ul').stop().fadeOut('slow'); 
     } 
    ); 
}); 

而关于你的HTML - ID-S应该是唯一的!

+0

谢谢,完美的作品 – luis 2013-03-07 16:22:58

试一试ClassName。然后它会工作。

小提琴例:http://jsfiddle.net/RrYs4/6/

JQuery的:

$(document).ready(function(){ 
    $('.top_menu_btnx').hover(
     function(){ 
      $(this).children('ul').stop().fadeIn('slow'); 
     }, 
     function(){ 
      $(this).children('ul').stop().fadeOut('slow'); 
     } 
    ); 
}); 
+0

佐尔坦已经写它。谢谢,真的很感激它。 – luis 2013-03-07 16:23:59

+0

@luisito:Oh Ok NP。谢谢.. – Pandian 2013-03-07 16:24:52