jquery - 如何使用 Jquery 淡入垂直菜单子(monad)项

标签 jquery css superfish

<分区>

这是我的垂直菜单 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/

上一篇:css - TextBox 在 silverlight 中不显示任何文本

下一篇:css - float :right div will not display inline

相关文章:

javascript - 将分页点和文本标题添加到小型 jQuery 轮播

javascript - VB.NET 如何在 GeckoFX 中禁用 javascript 警报和 javascript 错误

javascript - for 循环中的 Jquery .hover() : strange scope issue

javascript - 滚动期间粘性侧边栏闪烁

jquery - Superfish 在 Concrete5 编辑模式中将悬停类添加到父项

javascript - Highcharts 轴填充偏移量

javascript - 滚动到顶部动画作为百分比

javascript - 自定义 CSS 按钮动画在 MVC C# 局部 View 中不起作用

javascript - IE6中的 super 鱼问题

javascript - Superfish 菜单在 IE9 中显示结构损坏,在 Chrome 中工作正常