【发布时间】:2010-07-15 18:46:18
【问题描述】:
我有一个垂直推荐带,我有这种方法,它每隔几秒用一个计算值(取决于当前推荐的高度)为其top 值设置动画。
现在,当用户将鼠标悬停在其上时,它会立即停止(通过.stop() 并且通过clearInterval(idOfinterval) 清除间隔
但我仍然想知道在它突然停止之前它还剩下多少像素来制作动画。
所以我查看了documentation,我看到有一个step 方法,它有一个回调并且可以给我关于动画的每个(?)步骤的信息。
查看部分代码
//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);
}
所以我的主要问题是
step 方法的参数中获得什么信息?【问题讨论】:
标签: javascript jquery jquery-animate