【发布时间】:2009-08-07 06:53:29
【问题描述】:
我有一个 jQuery 动画,它可以为容器上的“scrollLeft”设置动画以产生一种“选框”效果。
我已经设置了它,所以当鼠标悬停在容器上时它会停止动画,而在鼠标离开时它会恢复。
$(banksContainer).mouseover(function() {
$(banksContainer).stop(false);
});
$(banksContainer).mouseleave(function() {
startAnimation();
});
每当我将鼠标移到动画上然后离开动画时,它都会以非常缓慢的速度恢复,但大约一分钟后会逐渐恢复。
为什么会发生这种情况,可以解决吗?
PS。这是请求的 startAnimation 函数:
// recursive function - represents one cycle of the marquee
function startAnimation() {
$(banksContainer).animate(
{ scrollLeft: scrollLeftEnd },
35000,
"linear",
function() {
$(this)[0].scrollLeft = scrollLeftHome;
startAnimation();
}
);
}
【问题讨论】:
-
可以发一下startAnimation函数吗?
标签: jquery performance jquery-animate resume