I have a box which needs to bounce and highlight at the same time.
I use this code for effect and works perfectly:
$(".box").click(function () {
$("#id1").effect("highlight", {color:"#669966"}, 2000).effect("bounce", { times:3 }, 300).dequeue().unbind(click);
});
But if you click second time before the animation finish, the box doesn’t come to it’s original color.
Here is jFiddle to test it: http://jsfiddle.net/EyeD4/
Thank you for your advice
Change
unbind(click)tounbind('click').You were trying to unbind a variable called
click, which was ineffective.http://jsfiddle.net/ExplosionPIlls/EyeD4/1/
Unrelated, but I suggest using
.on('click')and.off('click')instead of.clickand.unbind('click'), respectively.