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 );
});
精彩评论