<分区>
<分区>
这是我的垂直菜单 http://jsfiddle.net/3PD7D/13/
如果您将鼠标悬停在名为文件夹的菜单项上,则不会发生任何事情,但是如果您转到菜单项应该出现的位置(在“文件夹”菜单项的右侧),jquery 会在子菜单项中淡出。当用户将鼠标悬停在父级“文件夹”菜单项上时,如何让它们淡入?
已编辑 我很抱歉没有以正确的方式询问。这是我应该发布的原始代码。非常感谢 CasperOne 并向我展示了我的方法的错误。
$(文档).ready(函数(){
//Set the anchor link opacity to 0 and begin hover function
$("ul.child").css({"opacity" : 0}).hover(function(){
//Fade to an opacity of 1 at a speed of 200ms
$(this).stop().animate({"opacity" : 1}, 200);
//On mouse-off
}, function(){
//Fade to an opacity of 0 at a speed of 100ms
$(this).stop().animate({"opacity" : 0}, 100);
});
最佳答案
参见 there用于工作样本。
$(document).ready(function(){
//Set the anchor link opacity to 0 and begin hover function
$("ul.child").parent().hover(function(){
//Fade to an opacity of 1 at a speed of 200ms
$(this).find("ul.child").stop().animate({"opacity" : 1}, 200);
//On mouse-off
}, function(){
//Fade to an opacity of 0 at a speed of 100ms
$(this).find("ul.child").stop().animate({"opacity" : 0}, 100);
});
});
关于jquery - 如何使用 Jquery 淡入垂直菜单子(monad)项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12935518/