当右图位于 +400px 时如何添加 if 语句,然后在悬停右图时动画回到 -400px...?
$('#left img').mouseenter(function() {
$('#right img').animate({
left: '+=400px'
}, 700);
});
$('#right img').mouseenter(function() {
$('#left img').animate({
left: '-=400px'
}, 700);
});
类似于 this 的内容. (网站上的两个主要图片)
最佳答案
为什么不使用:mouseleave
$("#left img").mouseenter(function(){
//+400
}).mouseleave(function(){
//-400
});
Peraphs 与 mouseover/mouseout AND hover 相同
关于javascript - jquery if语句动画返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2488859/