Animate offset with jquery
10,662
Solution 1
I'm no expert but I think animate() and css() can change offset relative to the parent.. like position() while offset() gives you the offset from the whole document.. maybe thats what confuses?
Solution 2
Try
$("#source").animate({left: (left + 10), top:(top + 10 + ((current)*60))}, 500, function()
{ //comments });
For more info, see http://forum.jquery.com/topic/offset-with-animate
Author by
Tim
Updated on June 04, 2022Comments
-
Tim almost 2 years
I'm doing this :
source.offset({ top: top + 10 + (current)*60 , left: left + 10 });
What I would like to do is to animate the move. So I've done :
source.animate({left: left + 10, top:top + 10 + (current)*60}, 500, function() { // Animation complete.});
But it's not going to the right place. Although with the first version it was ok.
What am I doing wrong ?
Thanks for your help