Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.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
jQuery设置3个div的动画,悬停时延迟_Jquery_Html_Hover - Fatal编程技术网

jQuery设置3个div的动画,悬停时延迟

jQuery设置3个div的动画,悬停时延迟,jquery,html,hover,Jquery,Html,Hover,我试图创造一种效果,我将鼠标悬停在一个div(类为“hover”)上,其他三个div(“agent”、“fav”和“more_details”)向上移动,但三个div之间有一个短暂的延迟。然后,当我悬停时,所有3个div同时向下移动。这是我目前正在尝试的代码 jQuery(document).ready(function() { jQuery(".hover").hover( function(){ jQuery(".agent").animate({top: '-=32px'}

我试图创造一种效果,我将鼠标悬停在一个div(类为“hover”)上,其他三个div(“agent”、“fav”和“more_details”)向上移动,但三个div之间有一个短暂的延迟。然后,当我悬停时,所有3个div同时向下移动。这是我目前正在尝试的代码

jQuery(document).ready(function() {
jQuery(".hover").hover(
    function(){
    jQuery(".agent").animate({top: '-=32px'},400);
    },
    jQuery(".fav").animate({top: '-=32px'},400).delay(800);
    },
    jQuery(".more_details").animate({top: '-=32px'},400).delay(1600);
    },

    function(){
    jQuery(".agent,.fav,.more_details").animate({top: '+=32px'},400);
    }
);                              
});

有人能帮我在这里正确编写代码吗。

.delay
延迟链接到它的fx操作,而不是链接到它的fx操作:

jQuery(".fav").delay(800).animate({top: '-=32px'},400);
jQuery(".more_details").delay(1600).animate({top: '-=32px'},400);

我很确定你应该把延迟和动画连在一起,比如
动画。延迟。动画。延迟。动画。
我通常不是那样做的,所以我会听从更聪明的人。我们也能看到你的html吗?