jQuery Animation - Smooth Size Transition

前端 未结 8 2215
天命终不由人
天命终不由人 2020-11-28 07:30

So this might be really simple, but I haven\'t been able to find any examples to learn off of yet, so please bear with me. ;)

Here\'s basically what I want to do:

8条回答
  •  旧时难觅i
    2020-11-28 08:10

    This does the job for me. You can also add a width to the temp div.

    $('div#to-transition').wrap( '
    ' ); $('div#tmp').css( { height: $('div#to-transition').outerHeight() + 'px' } ); $('div#to-transition').fadeOut('fast', function() { $(this).html(new_html); $('div#tmp').animate( { height: $(this).outerHeight() + 'px' }, 'fast' ); $(this).fadeIn('fast', function() { $(this).unwrap(); }); });

提交回复
热议问题