开发者

jquery if statement animate back

How do I add an if statement when the right image is at +400px, then animate back to -400px... when hovering the right image?

$('#left img').mouseenter(function() {
  $('#right img').animate({
    left: '+=400px'
  }, 700);          开发者_Go百科                  

});
$('#right img').mouseenter(function() {
  $('#left img').animate({
    left: '-=400px'
  }, 700);

});

Something similar to this. (the two main images on the site)


Why simply not use: mouseleave

$("#left img").mouseenter(function(){
     //+400
    }).mouseleave(function(){
      //-400
    });

Peraphs is the same of mouseover / mouseout AND hover

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜