Wait to finish before next.

Wait to finish before next.

Hi, I am new to jquery and cannot figure this out.

I am using a extended class for addclass and removeclass.  These two lines are taken from the script.

addClass: function(classNames, speed, easing, callback) {...
removeClass: function(classNames,speed,easing,callback) {..

Basically the extended class puts an animation on the item.


THe issue is if I click on a item everything works, but if I click on another item very quick before the animation stops it starts again, so it does not wait for the call to finish, and I end up with two items marked as selected.


Here is my code.


[code]

$(document).ready(function(){ 
 $(".scrollable1 .items div").click(function () {
      $(".scrollable1 .items div").removeClass(".scrollable .items div selected", 0);
      $(this).addClass(".scrollable .items div selected", 1000);
    });
}); 
[/code]

Any help would be appreciated!