我需要使用jQuery顺利移动对象。我正在使用.animate()
方法。我正在制作它的position
属性。它几乎可以在任何地方使用,但Chrome中没有动画元素。
$('#element').animate({
'left': '+=' + 400 + 'px'
}, 800);
如何正确制作动画?
答案 0 :(得分:1)
设置边距动画似乎可以完成工作。只需使用:
$('#login').animate({
'margin-left': '+='+screen.width*2+'px'
}, 800, function(){ $('#login').addClass('inv'); });
$('#register').animate({
'margin-left': '-150px'
}, 800);