How can I realize that when I have a function
$('.anyclass').slideToggle(1000);
that the program exetutes the function test() after the slideToggle completed?
If I write like this:
$('.anyclass').slideToggle(1000);
test();
...test() gets executed before slideToggle completed.
How can I realize? I don't know jQuery very well ...
Thank you for your help! Regards, Florian
EDIT: Results u can see here: www.virtual-swiss-hornets.ch
I think slideToggle
should accept the second argument callback
, like this:
$('.anyclass').slideToggle(1000, function() {/* do anything after animation is complete */});
Actually for your particular case it is as easy as:
$('.anyclass').slideToggle(1000, test);
You can add a callback function to your jQuery function.
$('.anyclass').slideToggle(1000,function() { test(); });
That function will ONLY fire once the slide is complete.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With