Reputation: 23240
What I want to do is, to animate and hide some div, on closerlink button click, then hide this button. Function works but doesn't hide the closer_div
and gives error message:
ftr_form_cntr.stop(true, true).animate({height: "0"}, 1000).pause is not a function
on Firefox. Actually it does all operations exc. this line closer_div.hide();
.
Function looks like that
$(closer_link).click(function () {
ftr_form_cntr.find("div").fadeOut();
ftr_form_cntr.stop(true, true).animate({height:"0"},1000).pause(2000).hide();
closer_div.hide();
});
Upvotes: 0
Views: 160
Reputation: 49919
The animate function does have a callback function that will be triggered when the animation is completed, see code below:
ftr_form_cntr.stop(true, true).animate({height:"0"},1000, function(){
$(this).hide();
})
What you can also do, if you want a height of 0 and have it hidden after. Use the .slideUp()
function, this function also has a callback function.
ftr_form_cntr.stop(true, true).slideUp(1000);
If you want to animate, wait 1 second and do something else, do something like:
ftr_form_cntr.stop(true, true).animate({height:"0"},1000, function(){
var _this = $(this);
setTimeout(function(){
_this.hide();
}, 1000);
})
Another option can be the .delay()
, which waits 2 seconds.
ftr_form_cntr.stop(true, true).animate({height:"0"},1000).delay(2000).hide();
Upvotes: 2