【发布时间】:2016-04-19 00:17:17
【问题描述】:
我的 div text-button 未与我在其兄弟 div 下想要的正确边距对齐。我设置了position: absolute;,因为每次我将其设为相对时,jQuery 动画都不起作用。我希望text-button 出现在页面下方约 80% 的位置,然后设置为 70% 的动画,或者从兄弟 div text 获得 20% 的 margin-top,然后让它向上设置 10% 的动画。
我做错了什么?
$(function textdelays(){
$('#text-title').delay(600).fadeIn(1200);
$('#text').delay(600).fadeIn(1200);
$('#text-button').delay(900).fadeIn(1200);
$('#text-button').animate({'top': '70%'}, 1000);
});
.gray {
background-color: #CCC;
width: 100%;
height: 600px;
}
.content-wrap {
margin: 10% 25%;
position: absolute;
}
#text-title {
color: blue;
display: none;
position: relative;
/* margin: 0 25%;*/
font-size: 1.3em;
}
#text {
color: green;
display: none;
position: relative;
margin-top: 5%;
font-size: 1.1em;
}
#text-button {
position: relative;
wdith: 100%;
top: 80%;
display: none;
cursor: pointer;
}
.border-span {
border: 2px solid #000;
padding: 15px 10px;
color: #FFF;
font-weight: bold;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="gray">
<div class="content-wrap">
<div id="text-title">fdsfdasfdaffasG<br>
DIGITAL AGENCY</div>
<div id="text">
fdfdsf sdf asddd dddddd ddddd dddddd fdfsdaf dffdaf fdf fsda fdfas fdf dasaf f fdaa fdfdaf a dfdffd fdfffdffd fdfd dfdaad fda sd adgdg dggagdg gdfgfg agf gfgfag fgfg gfag fggf fgfgag f gfg ag afgfgfgfga fg.
</div>
<div id="text-button"><span class="border-span">More About Us</span></div>
</div>
</div>
【问题讨论】: