jQuery Animate顶部(从下到上)

我试图为Div设置一个top:275动画top:275

我尝试过.animate( {marginTop: -820 }但是在每个屏幕上它都会结束到不同的位置。

所以我将marginTop更改为.animate( {top: 275}但是div从上到下(滑动)。请注意,所以我可以使用animate:top我必须将div设置为position:absolute动画。 。 。

是否有任何hackyway使顶部从底部向上或使marginTop在每个屏幕分辨率上与顶部的距离相同? (我认为margintop无法解决,因为即时设置保证金最高至-820以获得最高点:275,因此屏幕小于1200px高度,div将会更高……)

这是我的代码:

 $("#features").fadeIn() .css({ position: 'absolute' }).animate({ top: '275' }, function() { //callback }); 

啊发现它!!

 $("#features").fadeIn() .css({top:1000,position:'absolute'}) .animate({top:275}, 800, function() { //callback }); 

所以基本上我把css的顶部设置在最后的1000,然后将它设置为275,这就是……

 $( '#features' ).show() .css( {'opacity': 0, 'bottom': '-100px' } ) .animate( { 'opacity': '1', 'bottom' : 0 }, 1000 );