Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.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设置移动动画_Jquery_Html_Jquery Animate - Fatal编程技术网

使用悬停jquery设置移动动画

使用悬停jquery设置移动动画,jquery,html,jquery-animate,Jquery,Html,Jquery Animate,我正试图获得一个图像链接,链接到bob在使用jquery悬停时上下移动……但到目前为止没有任何效果。代码如下: $("#footer").find("a").hover(function () { $(this).animate({ down: '+=10' }, 200); }, function () { $(this).animate({ down: '-=10' }, 200); }); 您要查找的CSS属性是bottom

我正试图获得一个图像链接,链接到bob在使用jquery悬停时上下移动……但到目前为止没有任何效果。代码如下:

$("#footer").find("a").hover(function () {
    $(this).animate({
        down: '+=10'
    }, 200);
}, function () {
    $(this).animate({
        down: '-=10'
    }, 200);
});

您要查找的CSS属性是
bottom
,而不是
down

$("#footer").find("a").hover(function () {
    $(this).animate({
        bottom: '+=10'
    }, 200);
}, function () {
    $(this).animate({
        bottom: '-=10'
    }, 200);
});
还要检查在CSS中,法师链接的位置是相对的还是绝对的,并且您已经为底部设置了一些值。否则就不行了

a {
    position: relative;
    bottom: 0;
}​

这里是我设置上述代码的地方。

如果您希望在用户鼠标进入链接时它上下摆动一次,请尝试以下操作


请注意,链接位于一个容器内,链接底部有足够的空间,以防止在链接动画超出鼠标范围时再次出现动画。

您的意思是:top:'+=10'?down不是属性,请使用top或bottom谢谢!确实有帮助,但是一旦鼠标离开该区域,图像是否可能停止上下跳动?
$(".animate_handler").mouseover(function () {
    $(".animate_link").animate({top: '-=10px'}, 200).animate({top: '+=10px'}, 200);
});