Before starting the animation, how about keeping the starting position?
startpostion = $(playerdiv).position(); //Or offset, I keep forgetting which
$(playerdiv).data("startTop",startposition.top);
$(playerdiv).data("startLeft",startposition.left);
Later you can get it with
left = $(playerdiv).data("startTop")
and etc.
You can always perform an animation callback using the step parameter, so you can update your slider accordingly.
$(playerdiv).animate({
top : targetTop,
left : targetLeft,
step, function(){ magic happens here
})
source
share