jquery mouse hover picture enlarged display

Source: Internet
Author: User

    • jquery mouse hover on the image after the image magnification, that is, the mouse moved to the image of the highlight, the mouse moved back to the original appearance, you can add this effect in the picture scrolling effects, I believe it will be more dazzling.

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title>jquery mouse hover picture amplification effect </title>
<script src= "/ajaxjs/jquery-1.9.1.min.js" type= "Text/javascript" ></script>
<script type= "Text/javascript" >
$ (function () {
var imgwid = 0;
var Imghei = 0; Variable initialization
var big = 1.2;//Magnification
$ (". Banimg li"). Hover (function () {
$ (this). FIND ("img"). Stop (True,true);
var ImgWid2 = 0;var ImgHei2 = 0;//local variable
Imgwid = $ (this). FIND ("img"). width ();
Imghei = $ (this). FIND ("img"). Height ();
ImgWid2 = Imgwid * BIG;
ImgHei2 = Imghei * BIG;
$ (this). FIND ("img"). CSS ({"Z-index": 2});
$ (this). FIND ("img"). Animate ({"width": imgWid2, "height": imgHei2, "Margin-left":-IMGWID2/2, "margin-top":-IMGHEI2/2 });
},function () {$ (this). FIND ("img"). Stop (). Animate ({"width": imgwid, "height": Imghei, "Margin-left":-IMGWID/2, " Margin-top ":-IMGHEI/2," Z-index ": 1});
})
</script>
<style type= "Text/css" >
*{margin:0; padding:0; list-style:none;}
. banimg{width:600px;height:200px; margin:20px Auto;}
. banimg li{width:200px; height:200px; float:left; position:relative;}
. banimg Li img{width:200px; height:200px; position:absolute; Left:50%;top:50%;margin: -100px 0 0-100px;z-index:1;}
</style>
<body>
<ul class= "Banimg" >
<li><a href= "#" ></a></li>
<li><a href= "#" ></a></li>
</ul>
</body>

jquery mouse hover picture enlarged display

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.