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.