我制作了一个基本的 div,里面有一个标题和一个段落,当我执行多步动画时,框向上移动而不是向下移动。它使它看起来非常故障和奇怪。您可以在 https://jsfiddle.net/yajuy8qy/ 查看我的错误. 代码:
<div class="enlarge">
<h1 class="title">Welcome!</h1>
<p>Zach</p>
</div>
<script>
$(document).ready(function() {
$(".enlarge").animate({minHeight: '500px'}, "slow");
$(".enlarge").animate({width: '80%'}, "slow");
});
</script>
<style>
.enlarge {
height: 500px;
width: 50%;
background-color: #2098D1;
align-items: center;
align-content: center;
border-radius: 15px;
position: relative;
margin: 10px auto;
}
</style>
谢谢!
最佳答案
默认填充属性似乎有问题。尝试在 div 上设置填充(即使出现 1px 也会修复故障)。
.enlarge{
padding: 1px;
}
关于javascript - 在动画过程中,我的动画 div 向上故障而不是向下故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42942039/