自动分页无限滚动脚本有一个名为offset. 我想将它传递给scrollPagination方法(当它再次被调用时),但我不知道该怎么做。
我需要这样做,因为该部分offset内的变量会发生变化afterLoad,而现在offsetforcontentPage参数始终为 0。
var offset = 0;
$('#stuffhere').scrollPagination({
'contentPage': 'themes/[var.theme]/ajaxcontrols.php?page=products&offset='+offset, // the page where you are searching for results
},
'afterLoad': function(elementsLoaded, offset){ // after loading, some function to animate results and hide a preloader div
offset = offset + [var.homelist]; alert(offset);
}
});
代码示例被修剪。
更新
这是我得到的结果。

我确实知道变量范围。我想将变量传递offset给.scrollPagination({,只是不知道该怎么做。使用.scrollPagination function(offset){不起作用。