用法示例 - mmrxia/js-pull-to-refresh GitHub Wiki

//模拟ajax加载
function ajax(params) {
  setTimeout(function() {
    params.success();
  }, 800);
}

var roll = new Roll("#wrapper");
roll.pulldown({
  refresh: function(complete) {
    ajax({
      success: function() {
        //异步数据加载完成后必须要执行该complete方法才能结束loading
        complete();

        //每行加20表示已刷新
        roll.scroller.innerHTML = roll.scroller.innerHTML.replace(/\d+/g, function(match) {
          return match * 1 + 20;
        });
      }
    });
  }
});