jQuery USES fadeout to implement the method of element fading

  • 2020-05-19 04:14:37
  • OfStack

This article illustrates an example of how jQuery USES fadeout to achieve the effect of element fading. Share with you for your reference. The specific analysis is as follows:

The JS code below demonstrates the effect of jQuery controlling the gradual concealment of a color block element, controlling the concealment speed


<!DOCTYPE html>
<html>
<head>
<script src="js/jquery.min.js">
</script>
<script>
$(document).ready(function(){
 $("button").click(function(){
  $("#div1").fadeOut();
  $("#div2").fadeOut("slow");
  $("#div3").fadeOut(3000);
 });
});
</script>
</head>
<body>
<p>Demonstrate fadeOut() with different parameters.</p>
<button>Click to fade out boxes</button>
<br><br>
<div id="div1" style="width:80px;height:80px;background-color:red;">
</div><br>
<div id="div2" style="width:80px;height:80px;background-color:green;">
</div><br>
<div id="div3" style="width:80px;height:80px;background-color:blue;">
</div>
</body>
</html>

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


Related articles: