Last active
December 10, 2015 23:08
-
-
Save adamalbrecht/4506923 to your computer and use it in GitHub Desktop.
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
$(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