jQuery: the fade out effect shows how an element is removed

  • 2020-05-16 06:23:21
  • OfStack

The example in this article shows how jQuery fades out after deleting an element to show the deletion process. Share with you for your reference. The specific analysis is as follows:

We want to see the deletion process when we delete an element. This effect shows the dynamic deletion process by fading out the element.


$("#myButton").click(function() {
  $("#myDiv").fadeTo("slow", 0.01, function(){//fade
    $(this).slideUp("slow", function() {//slide up
      $(this).remove();//then remove from the DOM
    });
  });
});

I hope this article has been helpful to your jQuery programming.


Related articles: