当元素的webkit-overflow-scrolling
设置为"触摸" (默认为iOS设备上的document.documentElement
),然后用户可以过度滚动内容。当用户释放touchevent
时,元素滚动到0需要一些时间。
如何检测过度滚动的结束?
答案 0 :(得分:1)
var overscroll;
window.addEventListener('touchstart', function () {
// User has very quick fingers.
overscroll = false;
});
window.addEventListener('touchend', function () {
// User released touch-drag event when element was in an overscroll state.
if (document.body.scrollTop < 0) {
overscroll = true;
}
});
window.addEventListener('scroll', function () {
if (overscroll && document.body.scrollTop == 0) {
overscroll = false;
console.log('end of overscroll');
}
});