_jquery based on jquery's fade and fade effect Foundation exercises

Source: Internet
Author: User
Today I practiced a jquery fade feature code as follows:
Copy Code code as follows:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Untitled Document </title>
<script type= ' text/javascript ' src= ' jquery-1.2.6.min.js ' ></script>
<style type= "Text/css" >
#gallery1 {width:100%; overflow:hidden;}
#gallery1 a {position:relative; float:left; margin:5px;}
#gallery1 a span {display:none background-image:url (zoom.png); background-repeat:no-repeat; width:48px; height:48px; Position:absolute; left:15px; top:15px;}
#gallery1 img {border:solid 1px #999; padding:5px;}
#gallery1 a:hover span {Display:block}
#gallery2 {width:100%; overflow:hidden;}
#gallery2 a {position:relative; float:left; margin:5px;}
#gallery2 a span {display:none background-image:url (zoom.png); background-repeat:no-repeat; width:48px; height:48px; Position:absolute; left:15px; top:15px;}
#gallery2 img {border:solid 1px #999; padding:5px;}
</style>
<script>
$ (document). Ready (function () {
$ ("#gallery2 a"). Append ("<span></span>");
$ ("#gallery2 a"). Hover (function () {
$ (this). Children ("span"). FadeIn (600);
},function () {
$ (this). Children ("span"). fadeout (200);
});
});
</script>
<body>
<div id= "Gallery1" >
<a href= "1.jpg" >
<span></span>

</a>
<a href= "2.jpg" >
<span></span>

</a>
</div>
<div id= "Gallery2" >
<a href= "1.jpg" >

</a>
<a href= "2.jpg" >

</a>
</div>
</body>

Pictures to use:
A small example of fading:
Copy Code code as follows:

<body>
<form action= "" method= "post" id = "MyForm" >
<button value= "click Me" >click me</button>
<p style= "background:red;" >context<br>context<br>context<br>context</p>
</form>
</body>

jquery Code
Copy Code code as follows:

$ (document). Ready (
function () {
/* fade in/fade out * *
$ ("button"). Toggle (
function () {
$ ("P"). Fadeout ("Fast", function () {
}
)
},
function () {
$ ("P"). FadeIn ("Fast", function () {
}
)
}
);
});

Demo Code http://demo.jb51.net/js/zoom_icon%20to_images/index.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.