javascript - jQuery: don't waiting till animation finish on multi clicks -


i need make on click event don't wait till current animation finish , execute last click.

example code http://jsfiddle.net/djpnu/
** try click 7 10 times fast , see animation going 1 after 1 slowly

$("button").click(function(){   $("div").animate({     height:'+=20px',     width:'+=20px'   }); }); 

thank you

you'll want use stop stops previous animation.

$("button").click(function(){   $("div").stop(true).animate({     height:'+=20px',     width:'+=20px'   }); }); 

http://jsfiddle.net/djpnu/1/

http://api.jquery.com/stop/


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -