Home >Web Front-end >JS Tutorial >jQuery method to show the deletion process by fading out after deleting an element_jquery

jQuery method to show the deletion process by fading out after deleting an element_jquery

WBOY
WBOYOriginal
2016-05-16 16:08:472025browse

The example in this article describes how jQuery deletes an element and then uses the fade-out effect to show the deletion process. Share it with everyone for your reference. The specific analysis is as follows:

When we delete an element, we hope to see the deletion process. 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 will be helpful to everyone’s jQuery programming.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn