Itay Grudev
Itay Grudev

Reputation: 7426

Google Chrome jQuery Animation lag in Google Chrome

I need to move an object smoothly with jQuery. I am using the .animate() method. I am animating it's position property. It pretty much works everywhere but the element isn't animated smoothly in Chrome.

$('#element').animate({
    'left': '+=' + 400 + 'px'
}, 800);

How should it be animated correctly?

Upvotes: 1

Views: 832

Answers (1)

Itay Grudev
Itay Grudev

Reputation: 7426

Animating the margin seems to do the work. Just use:

$('#login').animate({
    'margin-left': '+='+screen.width*2+'px'
}, 800, function(){ $('#login').addClass('inv'); });
$('#register').animate({
    'margin-left': '-150px'
}, 800);

Upvotes: 1

Related Questions