我想要获得一个图像链接bob了,并回落与jquery悬停...但迄今没有任何工作。继承人的代码:动画运动与悬停jquery
$("#footer").find("a").hover(function() {
$(this).animate({
down: '+=10'
}, 200);
}, function() {
$(this).animate({
down: '-=10'
}, 200);
});
我想要获得一个图像链接bob了,并回落与jquery悬停...但迄今没有任何工作。继承人的代码:动画运动与悬停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;
}
这里是我设置了上述代码的jsFiddle。
谢谢!真的有帮助,但是一旦鼠标离开该区域,图像可能会停止上下晃动吗? – davidhin
如果你正在寻找它上下起伏,一旦当用户的鼠标进入链接试试这个fiddle
$(".animate_handler").mouseover(function() {
$(".animate_link").animate({top: '-=10px'}, 200).animate({top: '+=10px'}, 200);
});
注意,链接是足够的空间容器内的链接的底部以防止动画在链接超出鼠标范围时重复出现。
do not you mean:top:'+ = 10'? – Koenyn
不是属性,请使用顶部或底部 – Tarun