Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/426.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery菜单工作不正常_Javascript_Jquery_Css_Drop Down Menu - Fatal编程技术网

Javascript jQuery菜单工作不正常

Javascript jQuery菜单工作不正常,javascript,jquery,css,drop-down-menu,Javascript,Jquery,Css,Drop Down Menu,我正在尝试让jQuery菜单运行,它悬停在每个项目上。这是你的电话号码。你可能会在结果中看到什么。当我悬停一个项目时,所有项目都会受到影响。我的错在哪里 下面是javascript代码: $(document).ready(function(){ //Remove outline from links $("a").click(function(){ $(this).blur(); }); //When mouse rolls over

我正在尝试让jQuery菜单运行,它悬停在每个项目上。这是你的电话号码。你可能会在结果中看到什么。当我悬停一个项目时,所有项目都会受到影响。我的错在哪里

下面是javascript代码:

$(document).ready(function(){

    //Remove outline from links
    $("a").click(function(){
        $(this).blur();
    });

    //When mouse rolls over
    $("li").mouseover(function(){
        $(this).stop().animate({height:'200px'},{queue:false, duration:600, easing: 'easeOutBounce'})
    });

    //When mouse is removed
    $("li").mouseout(function(){
        $(this).stop().animate({height:'140px'},{queue:false, duration:600, easing: 'easeOutBounce'})
    });

});

如果其余部分也是必要的,请查看

打开时需要设置负上边距。尽管这可能会证明lis的浮动存在问题

 //When mouse rolls over
    $("li").mouseover(function(){
        $(this).stop().animate({'height':'200px','margin-top':'-60px'},{queue:false, duration:600, easing: 'easeOutBounce'})
    });

//When mouse is removed
$("li").mouseout(function(){
    $(this).stop().animate({'height':'140px','margin-top':'0px'},{queue:false, duration:600, easing: 'easeOutBounce'})
});

这是关于CSS的。“li”越大,你的“ul”越大。试试这个:

$(document).ready(function(){

    //Remove outline from links
    $("a").click(function(){
        $(this).blur();
    });

    //When mouse rolls over
    $("li").mouseover(function(){
        $(this).stop().animate({marginTop:'-60px'},{queue:false, duration:600, easing: 'easeOutBounce'})
    });

    //When mouse is removed
    $("li").mouseout(function(){
        $(this).stop().animate({marginTop:'0px'},{queue:false, duration:600, easing: 'easeOutBounce'})
    });

});​