如何从jquery中获得相同的功能。单击as.hover?动画正在使用。悬停,但不是。单击
我正在写一个手风琴风格的作品,我想用鼠标悬停来制作它的动画,但是,我真的很想让它在点击而不是鼠标悬停时工作——当我换掉鼠标悬停的时候。鼠标悬停。鼠标悬停,没有动画发生 我做错了什么 谢谢你的帮助 -艾琳 这项工作:如何从jquery中获得相同的功能。单击as.hover?动画正在使用。悬停,但不是。单击,jquery,jquery-animate,Jquery,Jquery Animate,我正在写一个手风琴风格的作品,我想用鼠标悬停来制作它的动画,但是,我真的很想让它在点击而不是鼠标悬停时工作——当我换掉鼠标悬停的时候。鼠标悬停。鼠标悬停,没有动画发生 我做错了什么 谢谢你的帮助 -艾琳 这项工作: $('#productslider div.rum').hover(function(){ $(this).animate({left:'90px'}, 500); $(".vodka").animate({left:'0px'}, 500); }, functi
$('#productslider div.rum').hover(function(){
$(this).animate({left:'90px'}, 500);
$(".vodka").animate({left:'0px'}, 500);
}, function(){
});
$('#productslider div.vodka').hover(function(){
$(this).animate({left:'-90px'}, 500);
$(".rum").animate({left:'575px'}, 500);
}, function(){
});
这一切都不会发生:
$('#productslider div.rum').click(function(){
$(this).animate({left:'90px'}, 500);
$(".vodka").animate({left:'0px'}, 500);
}, function(){
});
$('#productslider div.vodka').click(function(){
$(this).animate({left:'-90px'}, 500);
$(".rum").animate({left:'575px'}, 500);
}, function(){
});
从单击事件中删除
},function(){
,这应该是
$('#productslider div.rum').click(function(){
$(this).animate({left:'90px'}, 500);
$(".vodka").animate({left:'0px'}, 500);
});
删除第二个函数,
单击
只接受一个参数
$('#productslider div.rum').click(function(){
$(this).animate({left:'90px'}, 500);
$(".vodka").animate({left:'0px'}, 500);
});
我想这就是答案: