Skip to content

Instantly share code, notes, and snippets.

@adamalbrecht
Last active December 10, 2015 23:08
Show Gist options
  • Save adamalbrecht/4506923 to your computer and use it in GitHub Desktop.
Save adamalbrecht/4506923 to your computer and use it in GitHub Desktop.
$(document).ready(function(){
// .loading is a div at the bottom of the screen. Only display if there are additional records able to be loaded
if ($('.loading').length > 0) {
$(window).scroll(function() {
if ($(window).scrollTop() > $(document).height() - $(window).height() - 50) {
$('.loading').text("Loading more products")
// Fetch more records by pulling either JSON or straight HTML from the server
// Set the html for these records to a variable called additionalRecordsHtml
$('.results').append(additionalRecordsHtml)
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment