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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -