iscroll.js 如何监听滚动事件?
Reply:
var myScroll;
function loaded () {
myScroll = new IScroll('#wrapper', {
scrollbars: true,
mouseWheel: true,
interactiveScrollbars: true,
shrinkScrollbars: 'scale',
fadeScrollbars: true,
onScrollMove: function() {
console.log('onScrollMove');
}
});
}
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
IScroll5的scroll-probe.js版本有onScroll事件,这里需要在实例化的时候指定probeType来指定onScroll事件触发的频率(因为这个对性能有影响)
iscroll4里面好像有这样的方法: