IMO there are two reasonable ways to do this.
You can define triggerElement and place your overlay outside of this triggerElement element:
PullToRefresh.init({ mainElement: 'body', triggerElement: '#mainContent', onRefresh: refreshAll });
with the same markup
<body> <div id="containerForOverlays"></div> <div id="mainContent"></div> </body>
This way, everything inside #containerForOverlays will not trigger the update.
Or you can use the new hook shouldPullToRefresh() if your version already supports it.
An example where PullToRefresh depends on the checked flag
<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 do not suggest using 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 that you want to check.
You need to implement the correct shouldPullToRefresh() for your application to determine if it should be PullToRefresh active or not.
Thomas
source share