jquery realizes the method of displaying large picture when the mouse is sliding over small picture _jquery

Source: Internet
Author: User

The example of this article describes the method of jquery to display large image when the mouse is sliding over a small picture. Share to everyone for your reference. The implementation methods are as follows:

Copy Code code as follows:
<meta http-equiv= "Content-type" content= "Text/html;charset=utf-8"/>
<title></title>
<style type= "Text/css" >
li{list-style:none;float:left;margin-left:10px;}
</style>
<script type= "Text/javascript" src= "Jquery-1.8.2.min.js" ></script>
<script type= "Text/javascript" >
var data = {
"Images/11_s.jpg": ["images/11_b.jpg", "Beauty 1"],
"Images/22_s.jpg": ["images/22_b.jpg", "Beauty 2"],
"Images/33_s.jpg": ["images/33_b.jpg", "Beauty 3"],
"Images/44_s.jpg": ["images/44_b.jpg", "Beauty 4"]
};
$ (function () {
$.each (Data,function (key,value) {
Initialize the last div as hidden
$ ("div"). Last (). hide ();
Create a small graph node
var Smallpath = $ ("Set large map address and name
Bigimgpath = smallpath.attr ("Bigmappath", value[0));
Bigimgname = smallpath.attr ("Bigmapname", value[1));

$ ("div"). Append (Smallpath);

Add an event on a small map
Smallpath.mouseover (function () {
Last div fade effect
$ ("div"). Last (). FadeIn ("fast");
Get Large Map Address
$ ("#show"). attr ("src", $ (this). attr ("Bigmappath"));
Get a large diagram name and set a style
$ ("#imgTitle"). Text ($ (this). attr ("Bigmapname")). CSS ({"Background": "#ebf1de", "padding": "10px", "Margin-bottom": " 10px "});
});
Smallpath.mouseout (function () {
$ ("div"). Last (). fadeout ("fast");
});
});
});
</script>
<body>
<div></div>
<div>

</div>
</body>

I hope this article will help you with your jquery programming.

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.