Last active
May 6, 2018 15:24
-
-
Save desbest/f75cf33c64ef5cb1575c to your computer and use it in GitHub Desktop.
Auto Pagination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////javascript libraries used | |
//// jquery | |
//// scrollPagination | |
//// aeImageResize | |
//// masonry | |
var offset = 0; | |
$('#stuffhere').scrollPagination({ | |
'contentPage': 'themes/[var.theme]/ajaxcontrols.php?page=products&offset='+offset, // the page where you are searching for results | |
'contentData': {}, // you can pass the children().size() to know where is the pagination | |
'scrollTarget': $(window), // who gonna scroll? in this example, the full window | |
'heightOffset': 40, // how many pixels before reaching end of the page would loading start? positives numbers only please | |
'beforeLoad': function(){ // before load, some function, maybe display a preloader div | |
$('#loading').fadeIn(); | |
}, | |
'afterLoad': function(elementsLoaded, offset){ // after loading, some function to animate results and hide a preloader div | |
$('#loading').fadeOut(); | |
//var offset = offset + [var.homelist]; | |
$('.statrow').append(elementsLoaded).masonry('appended', elementsLoaded, true ); //masonry plugin | |
$( ".polaroid img" ).aeImageResize({ height: 200, width: 180 }); //imageresize plugin | |
//$(elementsLoaded).fadeInWithDelay(); | |
if ($('#stuffhere').children().size() > [var.maxpages] * [var.homelist]){ // when stop stop loading pagination | |
//$('#nomoreresults').fadeIn(); | |
$('#stuffhere').stopScrollPagination(); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment