jQuery USES the fadein method to implement the fade out effect instance

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

This article illustrates an example of how jQuery USES the fadein method to achieve a gradual effect. Share with you for your reference. The specific analysis is as follows:

The JS code below USES the fadein method of jQuery to control the gradual display of the specified color block


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

I hope this article has helped you with your jQuery programming.


Related articles: