我有一个 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();
}
);
}