I got a vertical testimonials belt and i have this method that animates its top value with a calculated value (depending on the height of the current testimonial) every few seconds.
Now when a user hovers over it, it stops right away (via .stop() and also the interval is cleared via clearInterval(idOfinterval)
But i still want to know how much more pixels it had left to animate before it suddenly got halted.
So i looked up in the documentation and i see that there is a step method that has a callback and can give me information on each(?) step of the animation.
see part of the code
//in middle of a object literal
animate:function(){
animAmmount = someCalculation;
testimonialsBelt.parentElment.animate({
top:"-="+howMuchIsLeft||animAmmount+"px"},
{step:function(step){
//here i am trying to get how much px it has moved so far
currTopVal = step;
console.log("currTopVal", currTopVal);
// i get some numbers, and i have no idea from where it got them
}
},
calculatedSpeed);
}
So my main questions are
step method?
It looks like the “this” symbol will be the element animate was called on. The first parameter to the callback looks like the value of the property animated on this step. The second parameter is an object that looks like this: