js或是jquery代码怎么写让图片在一个div里实现由远到近的渐变效果,即图片慢慢放大,超出div的部分不显示
展开全部
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>demo</title>
<script src="jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<style type="text/css">
body{
margin:0;
padding:0;
}
div{
width:500px;
height:300px;
border:1px solid red;
overflow:hidden;
margin:0 auto;
}
img{
width:0;
height:0;
margin-left:250px;
margin-top:150px;
padding:0;
}
</style>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('#img').animate({
width:"200%",
height:"200%",
marginLeft:"-200px",
marginTop:"-100px"
},10000);
});
</script>
<body>
<div class="showimg" id="showimg">
<img src="3.jpg" id="img" alt="Here is a pic" />
</div>
</body>
</html>
数值未经过计算,随便写的
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>demo</title>
<script src="jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<style type="text/css">
body{
margin:0;
padding:0;
}
div{
width:500px;
height:300px;
border:1px solid red;
overflow:hidden;
margin:0 auto;
}
img{
width:0;
height:0;
margin-left:250px;
margin-top:150px;
padding:0;
}
</style>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('#img').animate({
width:"200%",
height:"200%",
marginLeft:"-200px",
marginTop:"-100px"
},10000);
});
</script>
<body>
<div class="showimg" id="showimg">
<img src="3.jpg" id="img" alt="Here is a pic" />
</div>
</body>
</html>
数值未经过计算,随便写的
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询