<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>利用jquery制作图片经过放大效果</title>
<style>
*{
margin:0;
padding:0;
}
.bigbox, .smallbox{
width:130px;
height:174px;
}
.bigbox{
background:#CCCCCC;
position:relative;
padding:5px;
float:left;
margin:10px 0 0 10px;
display:inline;
}
.smallbox{
position:absolute;
left:50%;
top:50%;
margin-left:-65px;
margin-top:-87px;
}
.smallbox:hover{
cursor:pointer;
}
.smallbox img{
width:100%;
height:100%;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$(function(){
$(".smallbox").hover(function(){
$(this).animate({width:"150", height:"190", marginLeft:"-75px", marginTop:"-95px"},100);
}).mouseout(function(){
$(this).animate({width:"130", height:"174", marginLeft:"-65px", marginTop:"-87px"},200);
})
})
</script>
</head>
<body>
<div class="bigbox">
<div class="smallbox">
<img src="img.jpg" border="0" />
</div>
</div>
<div class="bigbox">
<div class="smallbox">
<img src="img.jpg" border="0" />
</div>
</div>
<div class="bigbox">
<div class="smallbox">
<img src="img.jpg" border="0" />
</div>
</div>
<div class="bigbox">
<div class="smallbox">
<img src="img.jpg" border="0" />
</div>
</div>
</body>
</html>