我正在使用 iScroll v5.1.1,我想要用户在页面上开始和结束滚动事件时的事件。
这是我的javascript,
myScroll = new IScroll('#scrollinginside', {
scrollbars: true,
mouseWheel: true,
interactiveScrollbars: true,
shrinkScrollbars: 'scale',
fadeScrollbars: false,
checkDOMChanges: true,
onScrollStart: function () {
console.log('scrolling is started');
},
onScrollEnd: function () {
console.log('scrolling stopped');
}
});
但是当我尝试滚动页面时,没有注册任何事件。我的 javascript 有什么问题?我错过了什么吗?
最佳答案
通过使用 , 解决了这个问题
myScroll = new IScroll('#scrollinginside', {
scrollbars: true,
mouseWheel: true,
interactiveScrollbars: true,
shrinkScrollbars: 'scale',
fadeScrollbars: false,
checkDOMChanges: true
});
myScroll.on ('scrollStart', function () {
console.log('Started');
});
myScroll.on ('scrollEnd', function () {
console.log('Ended');
});
关于javascript - 在 scrollstart 和 scrollend 上获取事件 - iscroll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25886973/