简体   繁体   English

JQuery Animate()从页面底部向上滑动

[英]JQuery Animate() slide div up from bottom of page

Hopefully simple but tried implementing answers from other SO questions to no avail. 希望简单,但尝试从其他SO问题实施答案无济于事。

I have a div I that I want to slide up from the bottom of the page when the document loads. 我有一个div我想在文档加载时从页面底部向上滑动。 However, I just cant seem to get the JQuery working. 但是,我似乎无法让JQuery工作。 Here is what I have: 这是我有的:

#content {
    width: 640px;
    margin:auto;
    margin-top: 2000px;
}

$(function(){

$('#content').animate({MarginTop: '50px',} 1000);

});

Basically, I just want to shrink the margin-top distance when the page loads. 基本上,我只是想在页面加载时缩小margin-top距离。

Can anyone point me in the right direction? 谁能指出我正确的方向? Thanks 谢谢

Try: 尝试:

$('#content').animate({'margin-top': '50px'}, 1000);

JsFiddle 的jsfiddle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM