Reputation: 1187
I have a page transition which uses jQuery animate. I found that the following code:
$("body").click(false);
is the best way to stop any mouse clicks on the page while the animation is running. But I'm not sure how to undo it! Any ideas?
Upvotes: 1
Views: 132
Reputation: 476
show me the animation code snippet. You should place $("body").unbind("click"); in the callback of the animation function. When it's done animating, it will unbind the click again.
Upvotes: 0
Reputation: 82251
You can check for :animated
length on body click.try this:
$('body').click(function () {
if ($(':animated').length) {
return false;
}
});
Upvotes: 2