Reputation: 8216
Ok so I have a tab class that is scrollable which works fine, but now I want to hide the controls if they cannot scroll in the direction that they are trying to go. so I have something like this;
function tab_left(){
$(".tab_link").each(function(){
//animation here
});
}
Then I want to create a function that will make sure that none of them are animated(because if they are there position will not be correct). Then it will fix the image to either display or not. The problem I am having is checking that none of them are being animated. Any help is appreciated.
Upvotes: 2
Views: 4886
Reputation: 25147
To check if an element is being animated you can do this:
if( $("#the-great-div").is(":animated") ){
alert("Yay!");
}
Or if you want, you can set a callback to be called when the animation is done: http://docs.jquery.com/Effects/animate
var finished = 0;
var callback = function (){
// Do whatever you want.
finished++;
}
$("#div").animate(params, duration, null, callback);
That callback parameter is usually available in all animation functions, not just animate. Finally, if you want to keep track of how many items have finished, a global variable should do (like finished
in this case).
Upvotes: 8