The auto-pagination infinite scrolling script has a variable called offset
. I want to pass it to the scrollPagination
method (for when it's called again), but I don't know how to do it.
I need to do this because the offset
variable changes inside the afterLoad
section, and right now the offset
for the contentPage
parameter is always 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);
}
});
The code sample is trimmed.
Update
Here's the result I'm getting.
I do know variable scope. I want to pass the variable offset
to .scrollPagination({
and just don't know how to do it. Using .scrollPagination function(offset){
doesn't work.