JQuery Animate()从页面底部向上滑动div [英] JQuery Animate() slide div up from bottom of page

查看:1338
本文介绍了JQuery Animate()从页面底部向上滑动div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个div,我想从页面底部向上滑动,当时文档加载。但是,我似乎不能让JQuery工作。这是我的:

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


$(函数(){

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

});

基本上,我只想缩小 margin-top 页面加载时的距离。



任何人都可以指向正确的方向吗?谢谢

解决方案

试试:

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

JsFiddle


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

解决方案

Try:

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

JsFiddle

这篇关于JQuery Animate()从页面底部向上滑动div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆