Search code examples
javascriptjqueryslideup

SlideUp() function issue


After using animate() to exact height for div, closing div with slideUp() function. But there is one problem: slideUp() leaves inline height (that created animate() function on the fly) as is. It doesn't remove it after function execution. Is there any other way to do it?

For opening

$(minreg_link).click(function () {
    if(ftr_form_cntr.is(':visible')){  
        if(minreg_div.is(':visible')){
            return
        }
        ftr_form_cntr.find("div").fadeOut();
        ftr_form_cntr.stop(true, true).animate({
            height:"100"
        },1000);
        minreg_div.fadeIn(1000);
        return;
    }
    ftr_form_cntr.show().stop(true, true).animate({
        height:"100"
    },1000);
    minreg_div.fadeIn(1000);
});

for closing

$(closer_link).click(function () {
    ftr_form_cntr.stop(true, true).slideUp(1000).find("div").fadeOut(1000);
    $(closer_div).hide(1000);
})

Solution

  • ftr_form_cntr.stop(true, true).slideUp(1000, function(){
      ftr_form_cntr.height(0);
    }).find("div").fadeOut(1000);