我有一个要设置动画的 div,我已对其进行设置,以便通过更改 marginTop 属性来设置动画。唯一的问题是当我将它动画到 marginTop: O 它不与包含 div 的顶部齐平,我不知道为什么。它很多,所以在 jsfiddle 中查看它更容易,http://jsfiddle.net/loriensleafs/F3wjg/21/并且通过单击顶部的出版物文本来提示动画。
有问题的 div 是 profile_850_HEADER,当它进行动画处理时,它看起来比包含 div 的顶部高出大约 10px,jquery 是:
var staff_CONTAINER_850_ht = $('#staff_CONTAINER_850').height();
$("#launcher").click(function() {
$("#staff_CONTAINER_850").animate({
marginTop: staff_CONTAINER_850_ht* -1
}, 300);
$("#profile_850_HEADER").animate({
marginTop: 0
}, 300);
$("#profile_850_BIO").delay(120).animate({
marginTop: 10
}, 450);
$("#profile_850_EDU").delay(220).animate({
marginTop: 10
}, 450);
$("#profile_850_CONTACT").delay(320).animate({
marginTop: 10
}, 450);
});
$(".close_850_profile").click(function() {
$("#staff_CONTAINER_850").animate({
marginTop: "0px"
}, 300);
$("#profile_850_HEADER").animate({
marginTop: 500
}, 200, function() {
$("#profile_850_BIO").css("margin-top", "485px");
$("#profile_850_EDU").css("margin-top", "485px");
$("#profile_850_CONTACT").css("margin-top", "485px");
});
});
这里的任何帮助都会很棒,我不知道为什么会这样。