Javascript JQuery Animate()从页面底部向上滑动div
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12241417/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JQuery Animate() slide div up from bottom of page
提问by MeltingDog
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. However, I just cant seem to get the JQuery working. Here is what I have:
我有一个 div,我想在加载文档时从页面底部向上滑动。但是,我似乎无法让 JQuery 工作。这是我所拥有的:
#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
任何人都可以指出我正确的方向吗?谢谢