I am trying to make an item not clickable when it is animated. When the animation is complete, I want it to be clicked again. I have been looking for some help on how to achieve this for a long time, but I can't get it to work, and I don't know why.
HTML:
<p> <span class="red" id="a">A</span><span id="llright" class="hide">llright</span> BCD </p>
When you press the A button, it moves to the left, and then the text disappears next to it.
jQuery:
(function() { var letterA = $('#a'), llright = $('#llright'); $('#a:not(.open)').live('click', function() { letterA.animate({ marginRight: "5.7in", }, 1300, function() { letterA.addClass('open'); llright.fadeIn(1300);
Animation works fine, but it doesn't:
if(letterA.is(':animated')) { letterA.unbind('click'); };
The last part does not work at all, even when I insert a simple warning () instead of unbind (), it looks like not when A moves, not.
I could really use some help here, I tried everything I could come up with.
thanks / oscar
source share