Jquery implements how to display a large image when the mouse slides over a small image. jquery slides over
This example describes how to display a large image when jquery moves the mouse over a small image. Share it with you for your reference. The specific implementation method is as follows:
Copy codeThe Code is as follows: <Head>
<Meta http-equiv = "content-type" content = "text/html; charset = UTF-8"/>
<Title> </title>
</Head>
<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 to hide
$ ("Div"). last (). hide ();
// Create a node for the thumbnail
Var smallPath = $ ("// Set the big image address and name
BigImgPath = smallPath. attr ("bigMapPath", value [0]);
BigImgName = smallPath. attr ("bigMapName", value [1]);
$ ("Div"). first (). append (smallPath );
// Add an event to the widget
SmallPath. mouseover (function (){
// Fade-in effect of the last div
$ ("Div"). last (). fadeIn ("fast ");
// Obtain the big image address
$ ("# Show"). attr ("src", $ (this). attr ("bigMapPath "));
// Obtain the big image name and set the 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>
</Html>
I hope this article will help you with jQuery programming.