IMO there are two reasonable ways to do this.
You can define a triggerElement
and put your overlay outside of this triggerElement:
PullToRefresh.init({
mainElement: 'body',
triggerElement: '#mainContent',
onRefresh: refreshAll
});
with a markup somewhat like this
<body>
<div id="containerForOverlays"></div>
<div id="mainContent"></div>
</body>
that way, everything inside of #containerForOverlays
won't trigger a refresh.
Or you could use the new hook shouldPullToRefresh()
if your version already supports it.
An example where PullToRefresh
depends on a checkbox to be checked
<label><input id="refresh" type="checkbox"> Pull to Refresh?</label>
using it like
PullToRefresh.init({
mainElement: 'body',
shouldPullToRefresh: function(){
return document.getElementById('pullToRefresh').checked
},
onRefresh: refreshAll
});
Of course I'm not suggesting that you use a checkbox in your production code. I just wanted to show how you could dynamically "turn PullToRefresh
on and off". In this example, depending on the checkbox to be checked.
It's up to you to implement the correct shouldPullToRefresh()
for your application to determine wether PullToRefresh
should be active or not.