Home  >  Article  >  Web Front-end  >  jQuery uses fadein method to achieve fade-out effect example_jquery

jQuery uses fadein method to achieve fade-out effect example_jquery

WBOY
WBOYOriginal
2016-05-16 16:07:281086browse

The example in this article describes how jQuery uses the fadein method to achieve the fade-out effect. Share it with everyone for your reference. The specific analysis is as follows:

The following JS code uses jQuery’s fadein method to control the function of gradually displaying 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 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