JQuery Animate() slide div up from bottom of page

最后都变了- 提交于 2019-12-08 16:15:21

问题


Hopefully simple but tried implementing answers from other SO questions to no avail.

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:

#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.

Can anyone point me in the right direction? Thanks


回答1:


Try:

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

JsFiddle



来源:https://stackoverflow.com/questions/12241417/jquery-animate-slide-div-up-from-bottom-of-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!