How to fade out div slowly, update content, and then fade in div slowly, using jQuery?

前端 未结 6 1560
梦如初夏
梦如初夏 2020-12-10 02:52

I have a div I want to fade out, update its content, and then fade back in. So far I have tried:

$(\'#myDivID\').fadeOut(\'slow\', function() {
         


        
6条回答
  •  既然无缘
    2020-12-10 03:26

    Something like this would work:

    $('#myDivID').fadeOut('slow', function() {
        $('#myDivID').replaceWith("
    " + content + "
    ") $('#myDivID').hide().delay(2000).fadeIn('slow'); });

    Test here: http://jsfiddle.net/tomgrohl/PgcTZ/

    I've put the hide before the delay to make the animation work.

提交回复
热议问题