【发布时间】:2014-08-03 18:01:46
【问题描述】:
我希望第三个 div 在它淡入时移动到第三个 div 内,但是,因为它的位置是绝对的,所以它的位置是正确的。请为这个问题提出一个解决方案。我还想要同时的淡入淡出和动画效果,但代码没有按预期工作。请帮忙!
<html>
<head>
<title>Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript" charset="UTF-8"></script>
<script src="animation.js"></script>
<link rel="stylesheet" type="text/css" href="req.css">
</head>
<body>
<div class="one"><button class="b">Click Me!</button></div>
<div class="two"></div>
<div class="three">
<div class="three1 anim" style="position:absolute;"></div>
<div class="three2 anim"></div>
<div class="three3 anim"></div>
</div>
</body>
</html>
jquery 和 css 代码如下:
one{
height: 100%;
width: 400px;
background: rgb(241, 196, 15);
float:left;
}
.two{
height: 100%;
width: 400px;
background: rgb(230, 126, 34);
float:left;
}
.three{
height: 100%;
width: 400px;
background: rgb(231, 76, 60);
float:left;
}
.three1{
height: 100px;
width: 350px;
margin-left: 25px;
margin-right: 25px;
margin-top:15px;
background: rgb(26, 188, 156);
float:left;
postion:absolute;
display:none;
}
.three2{
height: 100px;
width: 350px;
margin-left: 25px;
margin-right: 25px;
margin-top:15px;
background: rgb(46, 204, 113);
float:left;
postion:absolute;
display:none;
}
.three3{
height: 100px;
width: 350px;
margin-left: 25px;
margin-right: 25px;
margin-top:15px;
background: rgb(52, 152, 219);
float:left;
postion:absolute;
display:none;
}
JQuery:
$(document).ready(function(){
$('.b').click(function(){
$('.anim').fadeIn(2000);
$('.anim').animate({left:'100px'});
});
});
【问题讨论】:
标签: jquery css web jquery-animate fadein