Reputation: 1082
What I want to do:
So I want to fire a function that resizes the containing div when one of its children are deleted BUT only after its done fading out.
The Problem:
The wrapper div is being resized ( addToSlider(-1)
) before the 200 millisecond fade is done.
Here is my code:
$('.you img[imgid="' + deletedrow.id + '"]').parent().fadeOut(200, addToSlider(-1));
Upvotes: 0
Views: 82
Reputation: 318182
$('.you img[imgid="' + deletedrow.id + '"]').parent().fadeOut(200, function() {
addToSlider(-1);
});
When calling a function with the parenthesis, it's executed right away, so to pass parameters you'll need another anonymous function.
You can however reference the function directly without passing parameters, if that will work, and I'm guessing it won't and that you need to pass the -1
, but this is how you'd do that :
$('.you img[imgid="' + deletedrow.id + '"]').parent().fadeOut(200, addToSlider);
Upvotes: 2