it's a pretty trick to keep something at the bottom of ur html body. i used a blank to achieve this when to detect the bottom for pull-up-loadMore:
<sapn id="bottomLine"> </span>
<table id="bottomRefreshImg" style="display:none">
<tr><td><img src="refreshGreen.gif" /></td></tr>
<tr><td>loading...</td></tr>
</table>
</div> //close scroller
</div> //close wrapper
<div id="footer"></div>
<script src="./jquery-2.2.3.min.js"></script>
<script src="./iscroll.js"></script>
<script src="./page.js"></script>
</body>
the first line is the blank, in css, it looks like:
#bottomLine{
height:1px; //it's ivisible
font-size:1px;
}
and the corresponding js code in page.js:
var myScroll;
var myScroolHasCausedAddNew=0;
function loaded () {
myScroll = new IScroll('#wrapper', {
scrollbars: true,
scrollbars: 'custom',
mouseWheel: true,
click:true,
interactiveScrollbars: true,
shrinkScrollbars: 'scale',
fadeScrollbars: true,
snap:true,
snap:'table',
});
myScroll.on('scrollStart',function(){
if($("#bottomLine").position().top + myScroll.y-myScroll.wrapperHeight<11){
if(myScroll.directionY==1){
$("#bottomRefreshImg").show();
myScroolHasCausedAddNew=1;
}
}
return false;
});
myScroll.on('scrollEnd',function(){
if(myScroolHasCausedAddNew==1){
myScroolHasCausedAddNew=0;
$("#bottomRefreshImg").hide();
loadMore();
}
return false;
});
}
the answer for ur question is in the line "$("#bottomLine").position().top + myScroll.y-myScroll.wrapperHeight<11", where 11 is for tolerance, in fact, $("#bottomLine").position().top === myScroll.wrapperHeigh + Math.abs(myScroll.y).
Note that you don't really need to set so many iscroll propertites to have these code work, i just copy them from from my project. for more info about the iscroll properties, plz check the document of iscroll.
Hope this helps.
a little more for other readers on iscroll-refresh:
Do not forget to update ur iscroll after new items loaded, this is explained in the iscroll document.