开发者

JQuery - How to fix mouseover and mouseleave auto loop a lot of times?

When I faster to mouseover and leave #go in a short time, it will auto loop a lot of times. How to fix it??

$("#go").mouseover(function(){
  $("#block").animate({ width: "900px" }, 300 );
});

$("#go").mouseleave(function(){                       
  $("#block")开发者_运维百科.animate({ width: "0px" }, 300 );
});


use stop()

$("#go").mouseover(function(){
  $("#block").stop(true,true).animate({ width: "900px" }, 300 );
});

$("#go").mouseleave(function(){                       
  $("#block").animate({ width: "0px" }, 300 );
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜