function updateData(start, count) {
var div = document.createDocumentFragment();
for(var i=start, len=start+count; i<len; i++) {
var item = document.createElement('div');
item.className = 'item';
item.innerHTML = '<p>'+i+'</p><p><img src="https://mat1.gtimg.com/qqcdn/tupload/1652494466388.jpeg?v='+i+'"></p>';
div.appendChild(item);
}
document.querySelector('.content').appendChild(div);
}
var myScroller = new IScroll(document.querySelector('.wrapper'), {
mouseWheel: true,
probeType: 2
});
var start = 0;
var count = 20;
updateData(start, count);
myScroller.on('scroll', function() {
if (this.y - this.maxScrollY < 120) {
start += count;
updateData(start, count);
myScroller.refresh();
}
})
document.addEventListener('touchmove', function (e) {
e.preventDefault();
}, {
capture: false,
passive: false
});