在iScroll 5中停止滚动动量

时间:2015-05-05 08:52:46

标签: javascript iscroll

在iScroll 5中以动量滚动时,有没有办法打断滚动,将其停在轨道上?

我试图切换动量选项,并强制另一个scrollTo,但还没有找到我需要的行为。

以下是我失败的尝试:http://jsfiddle.net/chvtmwz5/4/

// only comes into effect once scroll is finished:    
myScroll.options.momentum = false;

// halts scroll, but forces it back to the start unless we know the current scroll
myScroll.scrollTo(0,0);

// halts div scroll but allows scrollbar scroll animation to continue
var currentX = myScroll.x;
myScroll.scrollTo(currentX + 1, 0); // (scrolling to the current value of x has no effect)

0 个答案:

没有答案