简体   繁体   English

onScrollStart时如何使用Iscroll获取滚动方向

[英]How to get scrolling direction with Iscroll when onScrollStart

How should I do to get the scrolling direction using onScrollStart and not onScrollEnd? 如何使用onScrollStart不是 onScrollEnd获取滚动方向?

For now, here is the code I found for onScrollEnd : 现在,这是我为onScrollEnd找到的代码:

var current_page = 1; 
var old_page = 0; 

funnction load() {
    myScrollH = new iScroll('wrapper', {
        onScrollEnd: function () {
            current_page = this.currPageX+1 
            if(old_page<current_page) { 
                console.log('right');
            } 
            else if (old_page>current_page) { 
                console.log('left');
            };
            old_page=current_page; 
        }
    })
};

load();

If someone has the answer... Tchuss ! 如果有人有答案... Tchuss! V. V.

During onScrollStart, the event Scroll is not fired. 在onScrollStart期间,不会触发Scroll事件。 So its not possible (i think) to implement the same. 因此,不可能(我认为)实现相同的目标。

Only on onScrollEnd, the Scroll Event is fired which has the direction. 仅在onScrollEnd上,才会触发具有方向的Scroll Event。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM