pulltorefresh.js - 暂时禁用

Pet*_*ter 8 javascript pull-to-refresh

我正在使用这个PullToRefresh插件:

https://github.com/BoxFactura/pulltorefresh.js#api

它运作良好,但我的页面上有一个带有div内联滚动的弹出窗口.问题是,当我想向上滚动(在div中)时,会触发PullToRefresh.当我的弹出窗口打开时,是否可以"删除"或暂时禁用PullToRefresh?

PullToRefresh.init({
    mainElement: 'body',
    onRefresh: function(){
        refreshAll();
    }
});
Run Code Online (Sandbox Code Playgroud)

编辑: delete PullToRefresh;//不起作用

edit2:https: //github.com/BoxFactura/pulltorefresh.js/blob/master/dist/pulltorefresh.js

Tom*_*aey 7

PullToRefresh.init()将返回一个带回调destroy()函数的对象:https://github.com/BoxFactura/pulltorefresh.js/blob/master/dist/pulltorefresh.js#L326

var refresher = PullToRefresh.init({
    mainElement: 'body',
    onRefresh: function(){
        refreshAll();
    }
});

// destroy the PullToRefresh EventListeners when you open your popup
refresher.destroy()
Run Code Online (Sandbox Code Playgroud)

还有一个开放的Github问题,关于改进初始化后破坏这个库的方法:https://github.com/BoxFactura/pulltorefresh.js/issues/22