jquery - How can i prevent click on a html element before completion of animation? -
i expanding/collapsing div using click event bind on div. expand/collapse takes place using $('#myid').animate(myfunctiontocollapse/expand). instance height of div 0 , click on div expand , click again before completion of expansion,the code collapse called , div gets out of shape. how can prevent click event second time when collapse/expansion going on?
you can check see if it's still animating in click function , if return false prevent default click action , propagation.
if($('#myid').is(':animated')){ return false; }
Comments
Post a Comment