Home >Web Front-end >JS Tutorial >Basic exercises for fade-in and fade-out special effects based on Jquery_jquery

Basic exercises for fade-in and fade-out special effects based on Jquery_jquery

WBOY
WBOYOriginal
2016-05-16 18:14:011173browse

Today I practiced the Jquery fade-in and fade-out feature code as follows:

Copy code The code is as follows:


< ;html xmlns="http://www.w3.org/1999/xhtml">


Untitled Document


<script> <br>$(document).ready(function(){ <br>$("#gallery2 a").append("<span>&lt ;/span>"); <br>$("#gallery2 a").hover(function(){ <br>$(this).children("span").fadeIn(600); <br>}, function(){ <br>$(this).children("span").fadeOut(200); <br>}); <br>}); <br></script>



CSS solution










< /div>

jQuery solution












used Picture:
A small fade in and out example:
Copy code The code is as follows:




context
context
context
context



< ;/body>


Jquery code
Copy code Code As follows:

$(document).ready(
function() {
/*Fade in and out*/
$("button").toggle(
function (){
$("p").fadeOut("fast",function(){
}
)
},
function (){
$("p ").fadeIn("fast",function(){
}
)
}
);
});

Demo Code http://demo.jb51.net/js/zoom_icon to_images/index.htm
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