我试图获得一个基本的fadeIn
儿童ul
#access ul li:hover > ul
悬停后,然后fadeOut
徘徊。我有这样的代码,但它不工作:如何淡入/淡出菜单时悬停在父母上的儿童
jQuery(document).ready(function(){
jQuery("#access ul li").hover(function() {
jQuery(this).children("ul").fadeIn(500);
}, function() {
jQuery(this).children("ul").fadeOut(500);
});
});
下面的代码工作样的,但越野车,因为我没有影响只是this
孩子:
jQuery(document).ready(function(){
jQuery("#access ul li").hover(function() {
jQuery(this).children("ul").fadeIn(500).animate({top: '-=10'}, 500, function() { });
}, function() {
jQuery("#access ul li > ul").fadeOut(500).animate({top: '+=10'}, 500, function() { });
});
});
没有人有任何想法为什么顶级版本不起作用?
这里的HTML:
<nav id="access" role="navigation">
<div class="menu"><ul>
<li><a href="#" title="Home">Home</a></li>
<li><a href="#" title="Sample Page">Sample Page</a>
<ul class='children'>
<li><a href="#"; title="About Me">About Me</a></li>
<li><a href="#" title="Another Page">Another Page</a></li>
</ul>
</li>
</ul></div>
</nav>
会有所帮助。 – Dutchie432 2011-12-21 18:32:03