How do you pause before fading an element out using jQuery?

后端 未结 8 494
滥情空心
滥情空心 2020-12-29 03:12

I would like to flash a success message on my page.

I am using the jQuery fadeOut method to fade and then remove the element. I can increase the duratio

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 04:14

    var $msg = $('#msg-container-id');
    $msg.fadeIn(function(){
      setTimeout(function(){
        $msg.fadeOut(function(){
          $msg.remove();
        });
      },5000);
    });
    

提交回复
热议问题