Is it possible to slideToggle a div with Easing and set a min-height?

后端 未结 3 1917
天命终不由人
天命终不由人 2021-01-13 17:44

I have a div of which collapse and expands using slideToggle and easing.

$(\'button\').click(function () {
    $(\'div\').slideToggle(\'2000\', \"easeOutBoun         


        
3条回答
  •  梦毁少年i
    2021-01-13 18:05

    Not really. When the slide method is called, it gets the style property

    display: none;
    

    However, you may be able to dynamically fix it by using the callback function

    $('div').slideToggle('2000', "easeOutBounce", function() {
         $('div')[0].style.height="//whatever//"     //You could also use the min-height property
         $('div')[0].style.display="inline";
    );
    

    What exactly is the problem with animation?

提交回复
热议问题